Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleanup usage of go.rice in favor of go:embed #10956

Merged
merged 4 commits into from
Aug 9, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,3 @@ web/vtadmin/src/proto/*.ts -diff
go/vt/proto/** linguist-generated=true
go/vt/proto/*/*.pb.go -diff
go/vt/sqlparser/sql.go linguist-generated=true -diff
go/vt/mysqlctl/rice-box.go linguist-generated=true -diff
2 changes: 0 additions & 2 deletions .github/workflows/local_example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,4 @@ jobs:
if [ ${{matrix.os}} = "macos-latest" ]; then
export PATH="/usr/local/opt/mysql@5.7/bin:$PATH"
fi
# Make sure that testing is entirely non-reliant on config
mv config config-moved
eatmydata -- go run test.go -print-log -follow -retry=1 local_example
2 changes: 0 additions & 2 deletions .github/workflows/region_example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,5 @@ jobs:
if [ ${{matrix.os}} = "macos-latest" ]; then
export PATH="/usr/local/opt/mysql@5.7/bin:$PATH"
fi
# Make sure that testing is entirely non-reliant on config
mv config config-moved
sed -i 's/user\/my-vitess/runner\/work\/vitess\/vitess/g' examples/region_sharding/main_vschema_sharded.json #set correct path to countries.json
eatmydata -- go run test.go -print-log -follow -retry=1 region_example
24 changes: 1 addition & 23 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,6 @@ endif
# This is where Go will install binaries in response to `go build`.
export VTROOTBIN=${VTROOT}/bin

# regenerate rice-box.go when any of the .cnf files change
embed_config:
cd go/vt/mysqlctl && go run github.com/GeertJohan/go.rice/rice embed-go && go build .

# build the vitess binaries with dynamic dependency on libc
build-dyn:
ifndef NOBANNER
Expand All @@ -83,8 +79,6 @@ endif
-ldflags "$(shell tools/build_version_flags.sh)" \
-o ${VTROOTBIN} ./go/...

(cd go/cmd/vttablet && go run github.com/GeertJohan/go.rice/rice append --exec=${VTROOTBIN}/vttablet)

# build the vitess binaries statically
build:
ifndef NOBANNER
Expand All @@ -98,9 +92,6 @@ endif
-ldflags "$(shell tools/build_version_flags.sh)" \
-o ${VTROOTBIN} ./go/...

# embed local resources in the vttablet executable
(cd go/cmd/vttablet && go run github.com/GeertJohan/go.rice/rice append --exec=${VTROOT}/bin/vttablet)

# build vtorc with CGO, because it depends on sqlite
CGO_ENABLED=1 go build \
-trimpath $(EXTRA_BUILD_FLAGS) $(VT_GO_PARALLEL) \
Expand Down Expand Up @@ -129,19 +120,6 @@ endif
echo "Missing vttablet at: ${VTROOTBIN}/${GOOS}_${GOARCH}." && exit; \
fi

# Either ${GOPATH}/rice is already present, and we assume it is
# compiled to the architecture of this machine, or it's not present, in
# which case we need to download, compile and run it. We want to make
# sure we compile it in the current machine's architecture, otherwise
# we won't be able to run it.
@if [ -x "${GOPATH}/rice" ]; then \
echo "Applying ricebox to vttablet with already-present rice."; \
(cd ${VTROOT}/go/cmd/vttablet && ${GOPATH}/rice --verbose append --exec=${VTROOTBIN}/${GOOS}_${GOARCH}/vttablet); \
else \
echo "Applying ricebox to vttablet with download-and-compile rice."; \
(cd ${VTROOT}/go/cmd/vttablet && unset GOOS && unset GOARCH && go run github.com/GeertJohan/go.rice/rice --verbose append --exec=${VTROOTBIN}/${GOOS}_${GOARCH}/vttablet); \
fi

# Cross-compiling w/ cgo isn't trivial and we don't need vtorc, so we can skip building it

debug:
Expand Down Expand Up @@ -479,7 +457,7 @@ web_bootstrap:

# Do a production build of the vtctld UI.
# This target needs to be manually run every time any file within web/vtctld2/app
# is modified to regenerate rice-box.go
# is modified to regenerate assets.
web_build: web_bootstrap
./tools/web_build.sh

Expand Down
30 changes: 30 additions & 0 deletions config/embed.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package config

import _ "embed"

//go:embed init_db.sql
var DefaultInitDB string

//go:embed mycnf/default.cnf
var MycnfDefault string

//go:embed mycnf/mariadb100.cnf
var MycnfMariaDB100 string

//go:embed mycnf/mariadb101.cnf
var MycnfMariaDB101 string

//go:embed mycnf/mariadb102.cnf
var MycnfMariaDB102 string

//go:embed mycnf/mariadb103.cnf
var MycnfMariaDB103 string

//go:embed mycnf/mariadb104.cnf
var MycnfMariaDB104 string

//go:embed mycnf/mysql57.cnf
var MycnfMySQL57 string

//go:embed mycnf/mysql80.cnf
var MycnfMySQL80 string
8 changes: 0 additions & 8 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ require (
github.com/Azure/azure-pipeline-go v0.2.2
github.com/Azure/azure-storage-blob-go v0.10.0
github.com/DataDog/datadog-go v2.2.0+incompatible
github.com/GeertJohan/go.rice v1.0.0
github.com/HdrHistogram/hdrhistogram-go v0.9.0 // indirect
github.com/PuerkitoBio/goquery v1.5.1
github.com/aquarapid/vaultlib v0.5.1
Expand Down Expand Up @@ -126,16 +125,13 @@ require github.com/bndr/gotabulate v1.1.2
require (
cloud.google.com/go v0.81.0 // indirect
github.com/BurntSushi/toml v0.3.1 // indirect
github.com/GeertJohan/go.incremental v1.0.0 // indirect
github.com/akavel/rsrc v0.8.0 // indirect
github.com/andybalholm/cascadia v1.1.0 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/blang/semver v3.5.1+incompatible // indirect
github.com/coreos/go-semver v0.3.0 // indirect
github.com/coreos/go-systemd/v22 v22.3.2 // indirect
github.com/cpuguy83/go-md2man/v2 v2.0.1 // indirect
github.com/cyphar/filepath-securejoin v0.2.3 // indirect
github.com/daaku/go.zipexe v1.0.0 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/fatih/color v1.9.0 // indirect
github.com/felixge/httpsnoop v1.0.1 // indirect
Expand All @@ -151,7 +147,6 @@ require (
github.com/hashicorp/golang-lru v0.5.1 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/inconshreveable/mousetrap v1.0.0 // indirect
github.com/jessevdk/go-flags v1.4.0 // indirect
github.com/json-iterator/go v1.1.11 // indirect
github.com/jstemmer/go-junit-report v0.9.1 // indirect
github.com/mattn/go-colorable v0.1.6 // indirect
Expand All @@ -163,7 +158,6 @@ require (
github.com/mitchellh/mapstructure v1.4.1 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.1 // indirect
github.com/nkovacs/streamquote v0.0.0-20170412213628-49af9bddb229 // indirect
github.com/onsi/ginkgo v1.12.1 // indirect
github.com/onsi/gomega v1.10.3 // indirect
github.com/pelletier/go-toml v1.9.3 // indirect
Expand All @@ -178,8 +172,6 @@ require (
github.com/subosito/gotenv v1.2.0 // indirect
github.com/tidwall/match v1.1.1 // indirect
github.com/tidwall/pretty v1.2.0 // indirect
github.com/valyala/bytebufferpool v1.0.0 // indirect
github.com/valyala/fasttemplate v1.0.1 // indirect
go.opencensus.io v0.23.0 // indirect
go.uber.org/atomic v1.7.0 // indirect
go.uber.org/multierr v1.6.0 // indirect
Expand Down
16 changes: 0 additions & 16 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,6 @@ github.com/BurntSushi/xgbutil v0.0.0-20160919175755-f7c97cef3b4e h1:4ZrkT/RzpnRO
github.com/BurntSushi/xgbutil v0.0.0-20160919175755-f7c97cef3b4e/go.mod h1:uw9h2sd4WWHOPdJ13MQpwK5qYWKYDumDqxWWIknEQ+k=
github.com/DataDog/datadog-go v2.2.0+incompatible h1:V5BKkxACZLjzHjSgBbr2gvLA2Ae49yhc6CSY7MLy5k4=
github.com/DataDog/datadog-go v2.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ=
github.com/GeertJohan/go.incremental v1.0.0 h1:7AH+pY1XUgQE4Y1HcXYaMqAI0m9yrFqo/jt0CW30vsg=
github.com/GeertJohan/go.incremental v1.0.0/go.mod h1:6fAjUhbVuX1KcMD3c8TEgVUqmo4seqhv0i0kdATSkM0=
github.com/GeertJohan/go.rice v1.0.0 h1:KkI6O9uMaQU3VEKaj01ulavtF7o1fWT7+pk/4voiMLQ=
github.com/GeertJohan/go.rice v1.0.0/go.mod h1:eH6gbSOAUv07dQuZVnBmoDP8mgsM1rtixis4Tib9if0=
github.com/HdrHistogram/hdrhistogram-go v0.9.0 h1:dpujRju0R4M/QZzcnR1LH1qm+TVG3UzkWdp5tH1WMcg=
github.com/HdrHistogram/hdrhistogram-go v0.9.0/go.mod h1:nxrse8/Tzg2tg3DZcZjm6qEclQKK70g0KxO61gFFZD4=
github.com/Masterminds/glide v0.13.2/go.mod h1:STyF5vcenH/rUqTEv+/hBXlSTo7KYwg2oc2f4tzPWic=
Expand All @@ -97,8 +93,6 @@ github.com/PuerkitoBio/purell v1.1.1/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbt
github.com/PuerkitoBio/urlesc v0.0.0-20160726150825-5bd2802263f2/go.mod h1:uGdkoq3SwY9Y+13GIhn11/XLaGBb4BfwItxLd5jeuXE=
github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578/go.mod h1:uGdkoq3SwY9Y+13GIhn11/XLaGBb4BfwItxLd5jeuXE=
github.com/agnivade/levenshtein v1.0.1/go.mod h1:CURSv5d9Uaml+FovSIICkLbAUZ9S4RqaHDIsdSBg7lM=
github.com/akavel/rsrc v0.8.0 h1:zjWn7ukO9Kc5Q62DOJCcxGpXC18RawVtYAGdz2aLlfw=
github.com/akavel/rsrc v0.8.0/go.mod h1:uLoCtb9J+EyAqh+26kdrTgmzRBFPGOolLWKpdxkKq+c=
github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
Expand Down Expand Up @@ -177,8 +171,6 @@ github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7Do
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
github.com/cyphar/filepath-securejoin v0.2.3 h1:YX6ebbZCZP7VkM3scTTokDgBL2TY741X51MTk3ycuNI=
github.com/cyphar/filepath-securejoin v0.2.3/go.mod h1:aPGpWjXOXUn2NCNjFvBE6aRxGGx79pTxQpKOJNYHHl4=
github.com/daaku/go.zipexe v1.0.0 h1:VSOgZtH418pH9L16hC/JrgSNJbbAL26pj7lmD1+CGdY=
github.com/daaku/go.zipexe v1.0.0/go.mod h1:z8IiR6TsVLEYKwXAoE/I+8ys/sDkgTzSL0CLnGVd57E=
github.com/dave/jennifer v1.4.1 h1:XyqG6cn5RQsTj3qlWQTKlRGAyrTcsk1kUmWdZBzRjDw=
github.com/dave/jennifer v1.4.1/go.mod h1:7jEdnm+qBcxl8PC0zyp7vxcpSRnzXSt9r39tpTVGlwA=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
Expand Down Expand Up @@ -462,8 +454,6 @@ github.com/imdario/mergo v0.3.12 h1:b6R2BslTbIEToALKP7LxUvijTsNI9TAe80pLWN2g/HU=
github.com/imdario/mergo v0.3.12/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA=
github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM=
github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8=
github.com/jessevdk/go-flags v1.4.0 h1:4IU2WS7AumrZ/40jfhf4QVDMsQwqA7VEHozFRrGARJA=
github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI=
github.com/jmespath/go-jmespath v0.3.0/go.mod h1:9QtRXoHjLGCJ5IBSaohpXITPlowMeeYCZ7fLUTSywik=
github.com/jmespath/go-jmespath v0.4.0 h1:BEgLn5cpjn8UN1mAw4NjwDrS35OdebyEtFe+9YPoQUg=
github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo=
Expand Down Expand Up @@ -578,8 +568,6 @@ github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRW
github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U=
github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f/go.mod h1:ZdcZmHo+o7JKHSa8/e818NopupXU1YMK5fe1lsApnBw=
github.com/ngdinhtoan/glide-cleanup v0.2.0/go.mod h1:UQzsmiDOb8YV3nOsCxK/c9zPpCZVNoHScRE3EO9pVMM=
github.com/nkovacs/streamquote v0.0.0-20170412213628-49af9bddb229 h1:E2B8qYyeSgv5MXpmzZXRNp8IAQ4vjxIjhpAf5hv/tAg=
github.com/nkovacs/streamquote v0.0.0-20170412213628-49af9bddb229/go.mod h1:0aYXnNPJ8l7uZxf45rWW1a/uME32OF0rhiYGNQ2oF2E=
github.com/nxadm/tail v1.4.4 h1:DQuhQpB1tVlglWS2hLQ5OV6B5r8aGxSrPc5Qo6uTN78=
github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A=
github.com/olekukonko/tablewriter v0.0.0-20170122224234-a0225b3f23b5/go.mod h1:vsDQFd/mU46D+Z4whnwzcISnGGzXWMclvtLoiIKAKIo=
Expand Down Expand Up @@ -747,10 +735,6 @@ github.com/uber/jaeger-lib v2.4.1+incompatible h1:td4jdvLcExb4cBISKIpHuGoVXh+dVK
github.com/uber/jaeger-lib v2.4.1+incompatible/go.mod h1:ComeNDZlWwrWnDv8aPp0Ba6+uUTzImX/AauajbLI56U=
github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0=
github.com/urfave/cli v1.20.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA=
github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw=
github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc=
github.com/valyala/fasttemplate v1.0.1 h1:tY9CJiPnMXf1ERmG2EyK7gNUd+c6RKGD0IfU8WdUSz8=
github.com/valyala/fasttemplate v1.0.1/go.mod h1:UQGH1tvbgY+Nz5t2n7tXsz52dQxojPUpymEIMZ47gx8=
github.com/vektah/gqlparser v1.1.2/go.mod h1:1ycwN7Ij5njmMkPPAOaRFY4rET2Enx7IkVv3vaXspKw=
github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU=
github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q=
Expand Down
19 changes: 4 additions & 15 deletions go/cmd/vttablet/vttablet.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@ import (
"os"

"vitess.io/vitess/go/vt/vttablet/tabletmanager/vdiff"

rice "github.com/GeertJohan/go.rice"
"vitess.io/vitess/resources"

"vitess.io/vitess/go/vt/binlog"
"vitess.io/vitess/go/vt/dbconfigs"
Expand Down Expand Up @@ -171,24 +170,14 @@ func initConfig(tabletAlias *topodatapb.TabletAlias) (*tabletenv.TabletConfig, *
}

// extractOnlineDDL extracts the gh-ost binary from this executable. gh-ost is appended
// to vttablet executable by `make build` and via ricebox
// to vttablet executable by `make build` with a go:embed
func extractOnlineDDL() error {
if binaryFileName, isOverride := onlineddl.GhostBinaryFileName(); !isOverride {
riceBox, err := rice.FindBox("../../../resources/bin")
if err != nil {
return err
}

// there is no path override for gh-ost. We're expected to auto-extract gh-ost.
ghostBinary, err := riceBox.Bytes("gh-ost")
if err != nil {
return err
}
if err := os.WriteFile(binaryFileName, ghostBinary, 0755); err != nil {
if err := os.WriteFile(binaryFileName, resources.GhostBinary, 0755); err != nil {
// One possibility of failure is that gh-ost is up and running. In that case,
// let's pause and check if the running gh-ost is exact same binary as the one we wish to extract.
foundBytes, _ := os.ReadFile(binaryFileName)
if bytes.Equal(ghostBinary, foundBytes) {
if bytes.Equal(resources.GhostBinary, foundBytes) {
// OK, it's the same binary, there is no need to extract the file anyway
return nil
}
Expand Down
54 changes: 35 additions & 19 deletions go/vt/mysqlctl/mysqld.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ import (
"sync"
"time"

rice "github.com/GeertJohan/go.rice"
"vitess.io/vitess/config"

"vitess.io/vitess/go/mysql"
"vitess.io/vitess/go/vt/dbconfigs"
Expand Down Expand Up @@ -668,12 +668,7 @@ func (mysqld *Mysqld) Init(ctx context.Context, cnf *Mycnf, initDBSQLFile string
}

if initDBSQLFile == "" { // default to built-in
riceBox := rice.MustFindBox("../../../config")
sqlFile, err := riceBox.Open("init_db.sql")
if err != nil {
return fmt.Errorf("could not open built-in init_db.sql file")
}
if err := mysqld.executeMysqlScript(params, sqlFile); err != nil {
if err := mysqld.executeMysqlScript(params, strings.NewReader(config.DefaultInitDB)); err != nil {
return fmt.Errorf("failed to initialize mysqld: %v", err)
}
return nil
Expand Down Expand Up @@ -804,26 +799,47 @@ func (mysqld *Mysqld) getMycnfTemplate() string {
}
myTemplateSource := new(bytes.Buffer)
myTemplateSource.WriteString("[mysqld]\n")

riceBox := rice.MustFindBox("../../../config")
b, err := riceBox.Bytes("mycnf/default.cnf")
if err != nil {
log.Warningf("could not open embedded default.cnf config file")
}
myTemplateSource.Write(b)
myTemplateSource.WriteString(config.MycnfDefault)

// database flavor + version specific file.
// {flavor}{major}{minor}.cnf
f := FlavorMariaDB
if mysqld.capabilities.isMySQLLike() {
f = FlavorMySQL
}
fn := fmt.Sprintf("mycnf/%s%d%d.cnf", f, mysqld.capabilities.version.Major, mysqld.capabilities.version.Minor)
b, err = riceBox.Bytes(fn)
if err != nil {
log.Infof("this version of Vitess does not include built-in support for %v %v", mysqld.capabilities.flavor, mysqld.capabilities.version)
var versionConfig string
switch f {
case FlavorPercona, FlavorMySQL:
switch mysqld.capabilities.version.Major {
case 5:
if mysqld.capabilities.version.Minor == 7 {
versionConfig = config.MycnfMySQL57
} else {
log.Infof("this version of Vitess does not include built-in support for %v %v", mysqld.capabilities.flavor, mysqld.capabilities.version)
}
case 8:
versionConfig = config.MycnfMySQL80
default:
log.Infof("this version of Vitess does not include built-in support for %v %v", mysqld.capabilities.flavor, mysqld.capabilities.version)
}
case FlavorMariaDB:
switch mysqld.capabilities.version.Minor {
case 0:
versionConfig = config.MycnfMariaDB100
case 1:
versionConfig = config.MycnfMariaDB101
case 2:
versionConfig = config.MycnfMariaDB102
case 3:
versionConfig = config.MycnfMariaDB103
case 4:
versionConfig = config.MycnfMariaDB104
default:
log.Infof("this version of Vitess does not include built-in support for %v %v", mysqld.capabilities.flavor, mysqld.capabilities.version)
}
}
myTemplateSource.Write(b)

myTemplateSource.WriteString(versionConfig)

if extraCnf := os.Getenv("EXTRA_MY_CNF"); extraCnf != "" {
parts := strings.Split(extraCnf, ":")
Expand Down
Loading