-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Description
This issue is related to issue golang/lint#436. That issue is about a problem in the lint repository. This issue is about a problem in cmd/go
.
We added a go.mod file to the lint repository in CL 162913 today, following the process described in https://golang.org/issue/28136#issuecomment-462971974. We quickly learned via an issue report at golang/lint#436 that doing so caused go get -u golang.org/x/lint
to begin to fail when in module mode. Previously, go get -u golang.org/x/lint
succeeded in module mode. go get golang.org/x/lint
, without -u
continues to work.
The go.mod file specifies the module path to be "golang.org/x/lint", which matches the import path comment of the lint package. The import path comment means no current Go package can import the lint package at an import path other than golang.org/x/lint
successfully. However, older versions of modules can and do.
As @thepudds shared in golang/lint#436 (comment), there is an old module version that refers to lint repository via an incorrect github.com/golang/lint path:
google.golang.org/[email protected]
- https://github.com/grpc/grpc-go/blob/v1.16.0/go.mod#L7
That latest version of the github.com/openzipkin/zipkin-go
module is currently v0.1.5
. That version requires the bad old grpc version:
https://github.com/openzipkin/zipkin-go/blob/v0.1.5/go.mod#L27
What ends up happening is that installing the lint module ends up pulling in many modules incidentally (x/tools module -> appengine module -> ... -> x/build module -> ...). Some module ends up pulling in the latest module of zipkin-go
, which in turn pulls in the bad grpc
version. Since -u
flag is used, go get
fetches the latest pseudo-version of the github.com/golang/lint
module, which is now v0.0.0-20190227174305-5b3e6a55c961
and includes a go.mod file stating the module path to be golang.org/x/lint
, causing the error:
go: github.com/golang/[email protected]: parsing go.mod: unexpected module path "golang.org/x/lint"
There are a few issues here that should be investigated. For example, the error message from go get -u
can be improved to make diagnosing the situation better. Perhaps more.