go: cmd/go: go test -coverpkg=./... -race does not rebuild sync/atomic
Please answer these questions before submitting your issue. Thanks!
What version of Go are you using (go version
)?
go version devel +e776975 Sat Dec 31 18:54:27 2016 +0000 linux/amd64
What operating system and processor architecture are you using (go env
)?
GOARCH=“amd64” GOBIN=“” GOEXE=“” GOHOSTARCH=“amd64” GOHOSTOS=“linux” GOOS=“linux” GOPATH=“/home/travis/gopath” GORACE=“” GOROOT=“/home/travis/.gimme/versions/go” GOTOOLDIR=“/home/travis/.gimme/versions/go/pkg/tool/linux_amd64” GCCGO=“gccgo” CC=“gcc” GOGCCFLAGS=“-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build901867199=/tmp/go-build” CXX=“g++” CGO_ENABLED=“1” PKG_CONFIG=“pkg-config” CGO_CFLAGS=“-g -O2” CGO_CPPFLAGS=“” CGO_CXXFLAGS=“-g -O2” CGO_FFLAGS=“-g -O2” CGO_LDFLAGS=“-g -O2”
What did you do?
If possible, provide a recipe for reproducing the error. A complete runnable program is good. A link on play.golang.org is best.
- create an empty package https://github.com/hirochachacha/empty
- add .travis.yml
language: go
go:
- 1.5
- 1.6
- 1.7
- tip
script:
- go test -coverpkg=./... -race -v
- then, I see a build error. https://travis-ci.org/hirochachacha/empty
$ go test -coverpkg=./... -race -v
# github.com/hirochachacha/empty
/tmp/go-build559712700/github.com/hirochachacha/empty/_obj/empty.go:3: can't find import: "sync/atomic"
What did you expect to see?
no errors.
What did you see instead?
an error.
I could not reproduce it on my mac and linux. However, I can reproduce it on a docker container.
docker run -it quay.io/travisci/travis-go /bin/bash
and,
su - travis
GIMME_OUTPUT=$(gimme tip) && eval "$GIMME_OUTPUT"
export GOPATH=$HOME/gopath
export PATH=$HOME/gopath/bin:$PATH
go get github.com/hirochachacha/empty
cd $HOME/gopath/src/github.com/hirochachacha/empty
go test -coverpkg=./... -race -v
I have no clue. It may be travis’s issue? or something I am missing.
Thanks.
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Comments: 15 (13 by maintainers)
-coverpkg=./...
and-race
will work alone, but both of the flags together fail.I’ve isolated the issue to,
cmd/compile
not being able to compile a program importing std-lib with-race
. It can compile it without-race
though.Smaller repro case,
Looking into why
cmd/compile
fails to compile it with-race
.