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

go test -cover outputs build errors with incorrect line numbers #22414

Closed
leighmcculloch opened this issue Oct 24, 2017 · 1 comment
Closed

Comments

@leighmcculloch
Copy link
Contributor

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

go version go1.8 linux/amd64

Does this issue reproduce with the latest release?

Yes, I tried the same commands with go1.9 and the exact same output resulted.

go version go1.9 linux/amd64

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

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

$ git clone https://github.com/leighmcculloch/go-strrev.git
$ git checkout broken # ba1a9a9962908c303407878762304821fd764c4a
$ go test -cover

What did you expect to see?

I expected to see the same build error output as when I run go test.

$ go test
# 4d63.com/strrev
./strrev.go:17: undefined: bytes
./strrev.go:19: undefined: s
FAIL    4d63.com/strrev [build failed]

What did you see instead?

Different build error output, which displayed different line numbers and different locations for the files.

$ go test -cover  
# 4d63.com/strrev
/tmp/go-build636495490/4d63.com/strrev/_test/_obj_test/strrev.go:16: undefined: bytes
/tmp/go-build636495490/4d63.com/strrev/_test/_obj_test/strrev.go:19: undefined: s
FAIL    4d63.com/strrev [build failed]
@ianlancetaylor
Copy link
Member

Closing as dup of #6329.

@golang golang locked and limited conversation to collaborators Oct 24, 2018
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

3 participants