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 test -race can't create $WORK/net.a #20560

Closed
starius opened this issue Jun 2, 2017 · 4 comments
Closed

cmd/go: go test -race can't create $WORK/net.a #20560

starius opened this issue Jun 2, 2017 · 4 comments
Labels
FrozenDueToAge WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Milestone

Comments

@starius
Copy link

starius commented Jun 2, 2017

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.

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?

$ 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

Output of go test -x -race github.com/starius/racesync/...
https://gist.github.com/4c41db39b692b8f50ec8bd0d20910b1b

This issue was factored out from #20512 (comment)

@ianlancetaylor ianlancetaylor changed the title cmd/go: go test -race can't find "net" cmd/go: go test -race can't create $WORK/net.a Jun 2, 2017
@ianlancetaylor
Copy link
Contributor

How repeatable is this for you?

The error message is coming from the compiler. The compiler is saying that it can not create the output file because of a ENOENT error. As far as I can see this can only mean that the directory $WORK does not exist. And that makes no sense at all.

@ianlancetaylor ianlancetaylor added this to the Go1.9 milestone Jun 2, 2017
@starius
Copy link
Author

starius commented Jun 4, 2017

I found this error on my machine and then verified it on a clean GCP machine. Both machines run Debian.

@ianlancetaylor
Copy link
Contributor

This is happening because of your test, which is

	dir := os.TempDir()
	defer os.RemoveAll(dir)

The test removes the entire temporary directory while the go tool is using. The failure occurs because the temporary directory is gone when the Go compiler expects it to exist.

Don't do that.

@bradfitz bradfitz modified the milestones: Go1.9, Unplanned Jun 5, 2017
@bradfitz bradfitz added the WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. label Jun 5, 2017
@starius
Copy link
Author

starius commented Jun 5, 2017

Ahhh! I was so stupid doing dir := os.TempDir(). It was intended to create (and remove) a temp directory but instead just removed /tmp.

@starius starius closed this as completed Jun 5, 2017
starius added a commit to starius/invisiblefs that referenced this issue Jul 17, 2017
@golang golang locked and limited conversation to collaborators Jun 5, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Projects
None yet
Development

No branches or pull requests

4 participants