We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
go version
$ go version go version go1.15.2 linux/amd64
Don't know
go env
$ go env GO111MODULE="" GOARCH="amd64" GOBIN="" GOCACHE="/user/.cache/go-build" GOENV="/user/.config/go/env" GOEXE="" GOFLAGS="" GOHOSTARCH="amd64" GOHOSTOS="linux" GOINSECURE="" GOMODCACHE="/user/go/pkg/mod" GONOPROXY="" GONOSUMDB="" GOOS="linux" GOPATH="/user/go" GOPRIVATE="" GOPROXY="https://proxy.golang.org,direct" GOROOT="/usr/lib/go-1.15" GOSUMDB="sum.golang.org" GOTMPDIR="" GOTOOLDIR="/usr/lib/go-1.15/pkg/tool/linux_amd64" GCCGO="gccgo" AR="ar" CC="gcc" CXX="g++" CGO_ENABLED="1" GOMOD="/user/Projects/go-exasol-client/go.mod" CGO_CFLAGS="-g -O2" CGO_CPPFLAGS="" CGO_CXXFLAGS="-g -O2" CGO_FFLAGS="-g -O2" CGO_LDFLAGS="-g -O2" PKG_CONFIG="pkg-config" GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build284804196=/tmp/go-build -gno-record-gcc-switches"
I run a test using a TestMain:
TestMain
var ( exaClient *exaprovider.Client exaConf exasol.ConnConf ) func TestMain(m *testing.M) { flag.Parse() os.Exit(testRun(m)) } func testRun(m *testing.M) int { exaConf = internal.MustCreateTestConf() // Sets Port to 8563 exaClient = exaprovider.NewClient(exaConf) defer exaClient.Close() return m.Run() }
Would expect to never panic and never check true no matter what.
exasol.ConnConf has a field Port. If I add a check Port == 65040 into NewClient most of the times the check will be true.
exasol.ConnConf
Port
Port == 65040
NewClient
If I however also change testRun to:
testRun
func testRun(m *testing.M) int { exaConf = internal.MustCreateTestConf() if exaConf.Port == 65040 { panic("TESTRUN") } exaClient = exaprovider.NewClient(exaConf) defer exaClient.Close() return m.Run() }
it will never panic and the check inside NewClient will never be true.
Am I missing something obvious?
The text was updated successfully, but these errors were encountered:
try running with the race detector?
sounds like a bug in your code, see https://github.com/golang/go/wiki/Questions for appropriate channels to ask questions
Sorry, something went wrong.
Race detector is not complaining.
So I moved exaConf = internal.MustCreateTestConf() into a func init and it seems to work now. This really scares me.
exaConf = internal.MustCreateTestConf()
func init
No branches or pull requests
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Don't know
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
I run a test using a
TestMain
:What did you expect to see?
Would expect to never panic and never check true no matter what.
What did you see instead?
exasol.ConnConf
has a fieldPort
. If I add a checkPort == 65040
intoNewClient
most of the times the check will be true.If I however also change
testRun
to:it will never panic and the check inside
NewClient
will never be true.Am I missing something obvious?
The text was updated successfully, but these errors were encountered: