-
Notifications
You must be signed in to change notification settings - Fork 17.7k
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: race option doesn't work to test a code with binary-only package #26875
Comments
Edit: My bad, didn't notice your'e already compiling with -o. _, err := os.Stat(a.Package.Target)
if err == nil { This is the check that makes the test fail (err isn't nil) Edit 2: can you add the -o parameter to your test line? |
The binary-only package probably needs to be compiled in race mode, too. The error is about not finding a package archive at pkg/darwin_amd64_race/… |
@slrz You are right.
|
We don't even need to build with race option to test.
|
What version of Go are you using (
go version
)?go version go1.10.3 darwin/amd64
Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/motomuohtski/Library/Caches/go-build"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/motomuohtski/go"
GORACE=""
GOROOT="/usr/local/go"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/3t/1rcsh7wn6sb3_w2nbbnp0zc80000gn/T/go-build234195255=/tmp/go-build -gno-record-gcc-switches -fno-common"
What did you do?
${GOPATH}/src/github.com/motomux/hellobop/src/hellobop.go
${GOPATH}/src/github.com/motomux/hellobop/hellobop_header.go
Build binary by
go build -o ${GOPATH}/pkg/darwin_amd64/github.com/motomux/hellobop.a -x ./src
Have a test file
${GOPATH}/src/github.com/motomux/hellobop/test/helloboa_test.go
Run test by
go test ./test
Run test by
go test -race ./test
Here is the repository to reproduce the issue.
What did you expect to see?
go test -race
runs test without any error.What did you see instead?
It's failed with the error
go build github.com/motomux/hello: missing or invalid binary-only package
The text was updated successfully, but these errors were encountered: