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: build error reporting in wrong line/column/file with modules #27190

Closed
mitchellh opened this issue Aug 24, 2018 · 3 comments

Comments

Projects
None yet
2 participants
@mitchellh
Copy link

commented Aug 24, 2018

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

go version go1.11rc2 darwin/amd64

Does this issue reproduce with the latest release?

Latest go1.11 release - yes
Latest go1.10 - no because no modules

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

GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/mitchellh/Library/Caches/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/mitchellh/go"
GOPROXY=""
GORACE=""
GOROOT="/Users/mitchellh/code/3rdparty/go"
GOTMPDIR=""
GOTOOLDIR="/Users/mitchellh/code/3rdparty/go/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/Users/mitchellh/code/go/src/github.com/hashicorp/consul/go.mod"
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/gh/ts3cxwpd7l9cwb2n5z8j51980000gn/T/go-build206170924=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

Checkout 542cace9a from https://github.com/hashicorp/consul

$ git clone https://github.com/hashicorp/consul.git 
$ cd consul/
$ git checkout 542cace9a
$ go mod init
$ go test
...
# github.com/hashicorp/go-discover/provider/scaleway
/Users/mitchellh/go/pkg/mod/github.com/hashicorp/go-discover@v0.0.0-20180717234126-fc7e9a8d27eb/provider/scaleway/scaleway_discover.go:43:14: undefined: goversion.New
FAIL	github.com/hashicorp/consul [build failed]

If you open scaleway_discover.go, it has no reference to goversion.New. I can't find any reference to this at all anywhere.

I also ran from a clean build go mod tidy prior to go test and the same result.

What did you expect to see?

I expected the error to point me to a correct location.

What did you see instead?

I don't see any reference to goversion.New, the package in question isn't even imported:

$ sed -n 43p /Users/mitchellh/go/pkg/mod/github.com/hashicorp/go-discover@v0.0.0-20180717234126-fc7e9a8d27eb/provider/scaleway/scaleway_discover.go
api, err := api.New(organization, token, region)
@ianlancetaylor

This comment has been minimized.

Copy link
Contributor

commented Aug 24, 2018

Show us where api is defined in that file, and look at the package that it refers to.

@mitchellh

This comment has been minimized.

Copy link
Author

commented Aug 24, 2018

Points to github.com/nicolai86/scaleway-sdk@v1.11.1, which defines the package goversion. So that's where that comes from. I think the error message should probably use the import alias specified, but sorry for mistaking the package name which is obvious in retrospect.

go mod init didn't get the right package here either, but that's due to a weird vendor/ folder layout (nested vendor folders) that shouldn't have been there in the first place. I'll clean that up manually.

@mitchellh

This comment has been minimized.

Copy link
Author

commented Aug 24, 2018

I guess go has always errored this way and I just have never seen that error message! I'll close this, there's probably been thought behind it. https://play.golang.org/p/LE_lqQTUyoB

@mitchellh mitchellh closed this Aug 24, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.