-
Notifications
You must be signed in to change notification settings - Fork 18.8k
Closed as not planned
Closed as not planned
Copy link
Labels
Description
Go version
1.22
Output of go env in your module/workspace:
GO111MODULE=''
GOARCH='amd64'
GOBIN=''
GOCACHE='/home/jphillips/.cache/go-build'
GOENV='/home/jphillips/.config/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='amd64'
GOHOSTOS='linux'
GOINSECURE=''
GOMODCACHE='/home/jphillips/go/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='linux'
GOPATH='/home/jphillips/go'
GOPRIVATE=''
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/usr/local/go'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/usr/local/go/pkg/tool/linux_amd64'
GOVCS=''
GOVERSION='go1.22.0'
GCCGO='gccgo'
GOAMD64='v1'
AR='ar'
CC='gcc'
CXX='g++'
CGO_ENABLED='1'
GOMOD='/home/jphillips/devel/go1.22cover/go.mod'
GOWORK=''
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
PKG_CONFIG='pkg-config'
GOGCCFLAGS='-fPIC -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/tmp/go-build1439783943=/tmp/go-build -gno-record-gcc-switches'What did you do?
Due to #65570 my org wants to disable the coverage redesign in Go 1.22. When doing so via GOEXPERIMENT=nocoverageredesign it results in a panic from flags in different packages seemingly being compiled together.
What did you see happen?
> GOEXPERIMENT=nocoverageredesign go test -v -race -coverpkg=./... -coverprofile=profile.cov ./...
/tmp/go-build4211356336/b001/maina.test flag redefined: a
panic: /tmp/go-build4211356336/b001/maina.test flag redefined: a
goroutine 1 [running]:
flag.(*FlagSet).Var(0xc00014c000, {0x620ed0, 0xc00012a04f}, {0x61fb38, 0x1}, {0x5e6365, 0x6})
/usr/local/go/src/flag/flag.go:1028 +0x54d
flag.(*FlagSet).BoolVar(...)
/usr/local/go/src/flag/flag.go:749
flag.(*FlagSet).Bool(0xc00014c000, {0x61fb38, 0x1}, 0x0, {0x5e6365, 0x6})
/usr/local/go/src/flag/flag.go:762 +0x85
flag.Bool(...)
/usr/local/go/src/flag/flag.go:769
example.com/go122cover/maina.init()
/home/jphillips/devel/go1.22cover/maina/main.go:8 +0x4f
FAIL example.com/go122cover/maina 0.012s
/tmp/go-build4211356336/b096/mainb.test flag redefined: a
panic: /tmp/go-build4211356336/b096/mainb.test flag redefined: a
goroutine 1 [running]:
flag.(*FlagSet).Var(0xc0000bc000, {0x620ed0, 0xc00001413f}, {0x61fb38, 0x1}, {0x5e6365, 0x6})
/usr/local/go/src/flag/flag.go:1028 +0x54d
flag.(*FlagSet).BoolVar(...)
/usr/local/go/src/flag/flag.go:749
flag.(*FlagSet).Bool(0xc0000bc000, {0x61fb38, 0x1}, 0x0, {0x5e6365, 0x6})
/usr/local/go/src/flag/flag.go:762 +0x85
flag.Bool(...)
/usr/local/go/src/flag/flag.go:769
example.com/go122cover/mainb.init()
/home/jphillips/devel/go1.22cover/mainb/main.go:8 +0x4f
FAIL example.com/go122cover/mainb 0.012s
FAILWhat did you expect to see?
Tests running successfully. The same command runs fine in Go 1.21 and 1.22 without GOEXPERIMENT=nocoverageredesign.
> go test -v -race -coverpkg=./... -coverprofile=profile.cov ./...
=== RUN TestHelloWorld
hello, world
--- PASS: TestHelloWorld (0.00s)
PASS
coverage: 0.0% of statements in ./...
ok example.com/go122cover/maina 1.012s coverage: 0.0% of statements in ./...
=== RUN TestHelloWorld
hello, world
--- PASS: TestHelloWorld (0.00s)
PASS
coverage: 0.0% of statements in ./...
ok example.com/go122cover/mainb 1.013s coverage: 0.0% of statements in ./...
Reactions are currently unavailable