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 trips over "commented" build tags, when go build does not. #31938

Closed
MMulthaupt opened this issue May 9, 2019 · 3 comments
Closed
Labels
FrozenDueToAge WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.

Comments

@MMulthaupt
Copy link

MMulthaupt commented May 9, 2019

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

1.12.4

Does this issue reproduce with the latest release?

Yes.

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

go env Output
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/martin/.cache/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/martin/go"
GOPROXY=""
GORACE=""
GOROOT="/usr/local/go"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD=""
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 -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build126385444=/tmp/go-build -gno-record-gcc-switches"

What did you do?

Run go test ./... on a project which contained a package with a single .go-file where the first line was the following:

////+build ignore

What did you expect to see?

The same behaviour as go build, which is to ignore the build tag.

What did you see instead?

Return code 2 without any sort of error message.

@bradfitz
Copy link
Contributor

bradfitz commented May 9, 2019

I can't reproduce.

bradfitz@go:~/src/foo$ find .
.
./bar
./bar/all_test.go
bradfitz@go:~/src/foo$ cat bar/all_test.go 
////+build ignore
package bar
bradfitz@go:~/src/foo$ GOROOT=$HOME/go1.12 GO111MODULE=off go test -v -count=1  ./...
testing: warning: no tests to run
PASS
ok      foo/bar 0.003s [no tests to run]
bradfitz@go:~/src/foo$ echo $?
0

Can you give a complete repro?

@bradfitz bradfitz added the WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. label May 9, 2019
@bradfitz bradfitz changed the title go test trips over "commented" build tags, when go build does not. cmd/go: go test trips over "commented" build tags, when go build does not. May 9, 2019
@josharian
Copy link
Contributor

Possibly related: #26627

@MMulthaupt
Copy link
Author

I just noticed I actually did get a warning: possible malformed +build comment. I just did not see it because it was at the top instead of at the end of the output (where one typically expects errors). I'm closing this, though I am not quite convinced that treating this as a warning is a desirable behaviour.

@golang golang locked and limited conversation to collaborators May 12, 2020
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