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

cmd/go: go get -race can't find "sync/atomic" #20512

Closed
starius opened this issue May 27, 2017 · 18 comments
Closed

cmd/go: go get -race can't find "sync/atomic" #20512

starius opened this issue May 27, 2017 · 18 comments
Milestone

Comments

@starius
Copy link

@starius starius commented May 27, 2017

Can be a rebirth of #18486

What version of Go are you using (go version)?

go version go1.8.3 linux/amd64

This go version was compiled from source using make.bash.

This issue is not reproduced on the released binaries perhaps because of #18486 (comment)

What operating system and processor architecture are you using (go env)?

GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/bnagaev"
GORACE=""
GOROOT="/home/bnagaev/go"
GOTOOLDIR="/home/bnagaev/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build015631019=/tmp/go-build -gno-record-gcc-switches"
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?

I run go test -race and got weird errors:

$ go get -race
# sync
/scrubbed/src/sync/cond.go:8: can't find import: "sync/atomic"
# strconv
/scrubbed/src/strconv/atof.go:13: can't find import: "math"
# vendor/golang_org/x/crypto/poly1305
/scrubbed/src/vendor/golang_org/x/crypto/poly1305/poly1305.go:21: can't find import: "crypto/subtle"

I created minimal working example here: https://github.com/starius/racesync

To reproduce build go from source and run go get -race github.com/starius/racesync

@AlekSi

This comment has been minimized.

Copy link
Contributor

@AlekSi AlekSi commented May 27, 2017

Try to run the following commands:

go install -v std
go install -v -race std
@starius

This comment has been minimized.

Copy link
Author

@starius starius commented May 27, 2017

After running these commands go get -race succeeded.

@starius

This comment has been minimized.

Copy link
Author

@starius starius commented May 27, 2017

Is it a bug or WAI?

starius added a commit to starius/gohere that referenced this issue May 27, 2017
The build is expected to fail.

See golang/go#20512
@ianlancetaylor ianlancetaylor changed the title go get -race can't find "sync/atomic" cmd/go: go get -race can't find "sync/atomic" May 29, 2017
@ianlancetaylor

This comment has been minimized.

Copy link
Contributor

@ianlancetaylor ianlancetaylor commented May 29, 2017

In your comment text you wrote go test -race but in your title and example you wrote go get -race. I assume you mean go get -race.

This looks like a bug but it doesn't seem like a very important bug. Why are you writing go get -race?

@starius

This comment has been minimized.

Copy link
Author

@starius starius commented May 29, 2017

@ianlancetaylor
Both go get -race and go test -race fail. Initially I found the bug for go test -race but then I found that it has nothing to do with "test" part and used just go get -race in the minimal example.

starius pushed a commit to starius/config that referenced this issue May 29, 2017
starius added a commit to starius/config that referenced this issue May 30, 2017
@ianlancetaylor

This comment has been minimized.

Copy link
Contributor

@ianlancetaylor ianlancetaylor commented Jun 2, 2017

I can recreate this with go get but not with go test. I'm working on a fix for go get. If you can show me an example that fails with go test I would appreciate that.

@gopherbot

This comment has been minimized.

Copy link

@gopherbot gopherbot commented Jun 2, 2017

CL https://golang.org/cl/44630 mentions this issue.

@starius

This comment has been minimized.

Copy link
Author

@starius starius commented Jun 2, 2017

If you can show me an example that fails with go test I would appreciate that.

Done:

$ go get -t github.com/starius/racesync
$ go test -race github.com/starius/racesync/...
# net
can't create $WORK/net.a: open $WORK/net.a: no such file or directory

may be a different issue though.

@davecheney

This comment has been minimized.

Copy link
Contributor

@davecheney davecheney commented Jun 2, 2017

@starius

This comment has been minimized.

Copy link
Author

@starius starius commented Jun 2, 2017

Output of go test -x -race github.com/starius/racesync/.

https://gist.github.com/d87ab40a2d7e4a1df72588c96f734606

@davecheney

This comment has been minimized.

Copy link
Contributor

@davecheney davecheney commented Jun 2, 2017

@starius

This comment has been minimized.

Copy link
Author

@starius starius commented Jun 2, 2017

I think it succeed because the target was github.com/starius/racesync/. not github.com/starius/racesync/...

For go test -x -race github.com/starius/racesync/... I have
https://gist.github.com/4c41db39b692b8f50ec8bd0d20910b1b

Did you change anything between your previous post and this one?

I didn't.

Do you use a tool to manage this for you, or is it a personal choice?

Both :-)
I wrote a tool to download, build and install Go: https://github.com/starius/gohere
and used it to install Go to that directory.

I patched the tool to run go install -v -race std but I removed GOROOT/pkg/linux_amd64_race/ before running the commands.

Did you or the tool set GOROOT?

No. I also double checked that the variable GOROOT is not set.

@davecheney

This comment has been minimized.

Copy link
Contributor

@davecheney davecheney commented Jun 2, 2017

@starius

This comment has been minimized.

Copy link
Author

@starius starius commented Jun 2, 2017

I built Go 1.8.3 manually from source and used it from the directory where make.bash installed binaries itself:

$ cd ~/go/src
$ GOROOT_BOOTSTRAP=/home/bnagaev/.cache/gohere/go1.4.3_bootstrap ./make.bash
$ /home/bnagaev/go/bin/go get -t github.com/starius/racesync/...
$ /home/bnagaev/go/bin/go test -x -race github.com/starius/racesync/...

Error: https://gist.github.com/75bd5f630fabbd3f1eb7e4d3d37a33d1

@davecheney

This comment has been minimized.

Copy link
Contributor

@davecheney davecheney commented Jun 2, 2017

@starius

This comment has been minimized.

Copy link
Author

@starius starius commented Jun 2, 2017

GOPATH=/home/bnagaev

@davecheney

This comment has been minimized.

Copy link
Contributor

@davecheney davecheney commented Jun 2, 2017

@ianlancetaylor

This comment has been minimized.

Copy link
Contributor

@ianlancetaylor ianlancetaylor commented Jun 2, 2017

@starius Please open a new issue for the problem you are seeing with go test -race. That is clearly a different problem from the go get -race problem. I do not understand what you are seeing with go test -race. Thanks.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
5 participants
You can’t perform that action at this time.