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: test -race should automatically compile race enabled packages when unavailable #6479

Closed
titanous opened this issue Sep 25, 2013 · 13 comments
Milestone

Comments

@titanous
Copy link
Member

What steps will reproduce the problem?

Create a file with these contents and run `go test -race`:

    package main
    import _ "testing"


What is the expected output?

PASS

What do you see instead?

# testmain
/var/folders/gs/mznx8_ps7299rqztvxhggq7c0000gn/T/go-build422539209/_/Users/titanous/projects/go-tests/regexp-import/_test/_testmain.go:5:
can't find import: "regexp"
FAIL

Which version are you using?

go version devel +9c91baff43a1 Wed Sep 25 18:15:29 2013 +1000 darwin/amd64

Please provide any additional information below.

This is a regression since go1.1.2. `hg bisect` indicates that this issue is caused by:

    changeset:   17191:70a7a4257467
    user:        Russ Cox <rsc@golang.org>
    date:        Thu Jun 27 17:04:39 2013 -0400
    summary:     cmd/go: add -coverpkg
    https://code.google.com/p/go/source/detail?r=70a7a4257467dffb3ec7aa0ec6c1838e9143366a
@minux
Copy link
Member

minux commented Sep 25, 2013

Comment 1:

I can't reproduce the failure, could you be more specific how to reproduce it?
e.g. where to put the file, what's your GOPATH, what's your Go version, OS version?

Status changed to WaitingForReply.

@titanous
Copy link
Member Author

Comment 2:

I'm on OS X 10.8.5 with the latest tip revision (exact version in the original issue). I
called the file "foo_test.go" and put it in an empty directory. It doesn't matter if it
is in the GOPATH.

@minux
Copy link
Member

minux commented Sep 25, 2013

Comment 3:

i'm on OS X 10.8.4. Go version "go version devel +9c91baff43a1 Wed Sep 25 18:15:29 2013
+1000 darwin/amd64"
this is how i do:
mkdir empty
cd empty
cat >foo_test.go <<EOF
package main
import _ "testing"
EOF
go test -race
but still the test succeeds.

@titanous
Copy link
Member Author

Comment 4:

Ah, it looks like this only happens when the race version of the stdlib has not been
installed. Try with a completely clean install (hg purge --all && ./make.bash).

@minux
Copy link
Member

minux commented Sep 25, 2013

Comment 5:

ok, i can reproduce it now, just rm -rf $GOROOT/pkg/$GOOS_$GOARCH_race and then repeat
the step in #3.
for source install, we recommend all.bash which should install race enabled packages for
you.

Labels changed: added go1.2maybe.

Status changed to Accepted.

@dvyukov
Copy link
Member

dvyukov commented Sep 25, 2013

Comment 6:

>for source install, we recommend all.bash which should install race enabled packages
for you.
I believe it won't.
$ go  install -a -race std
will do.

@minux
Copy link
Member

minux commented Sep 25, 2013

Comment 7:

then bin/go will be race enabled, not ideal.
we probably should write some about proper ways to install race enabled std lib.

@rsc
Copy link
Contributor

rsc commented Oct 2, 2013

Comment 8:

Not changing this for Go 1.2.

Labels changed: added go1.3, removed go1.2maybe.

@rsc
Copy link
Contributor

rsc commented Dec 4, 2013

Comment 9:

Labels changed: added release-go1.3.

@rsc
Copy link
Contributor

rsc commented Dec 4, 2013

Comment 10:

Labels changed: removed go1.3.

@rsc
Copy link
Contributor

rsc commented Dec 4, 2013

Comment 11:

Labels changed: added repo-main.

@taralx
Copy link

taralx commented Feb 19, 2014

Comment 12:

Looks like the go install command works:
% sudo /path/to/bin/go install -a -race std
go install cmd/gofmt: build output "/path/to/bin/gofmt" already exists and is not an
object file
go install cmd/go: build output "/path/to/bin/go" already exists and is not an object
file
These were not overwritten, and the race libraries were installed.

@rsc
Copy link
Contributor

rsc commented Apr 3, 2014

Comment 13:

The only problem here is that regexp is somehow not a test dependency.

Status changed to Duplicate.

Merged into issue #6844.

@rsc rsc added this to the Go1.3 milestone Apr 14, 2015
@rsc rsc removed the release-go1.3 label Apr 14, 2015
@golang golang locked and limited conversation to collaborators Jun 25, 2016
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

6 participants