-
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: go get -u in module mode can fail and produce output that's not easy to diagnose #30455
Comments
That's #28489. |
One workaround might be to explicitly upgrade |
@bcmills That sounds like a valid quick fix for |
@dmitshur yet another possible solution might be merging edit: sorry, scratch that, I think that is actually not the right CL... but I had thought there was another pending CL that would further cut down on more of the |
@thepudds I had the same idea. I plan to prioritize getting that CL submitted tomorrow, as I think it will be very helpful for the x/tools module and everything that requires it. /cc @matloob Edit: I think it is the right CL, is it not? It removes appengine and x/sync from required modules, leaving only x/net. |
@dmitshur if you tell me it is the right CL, I would believe you. ;-) It does seem to be the one: https://go-review.googlesource.com/c/tools/+/160837/2/go.mod |
@bcmills in golang/lint#436 (comment) you said in part:
I am not sure how to think about the transitive import graph when the main module is empty ( Separately, if you start with an empty module and do
But admittedly those two sample commands above alone do not provide a complete view... and also that is not in the context of appengine build tags, so maybe that explains it or maybe test dependencies explain it, but I will confess I am not sure if there is another bug here or not.
I don't know if the fact that so much gets upgraded if you do |
It sounds like the Closing as duplicate of #28489, and let's keep the |
|
Hi @bcmills
What is an easy-ish way to see the transitive import graph, and does that "transitive import graph" as used in your quote at the top of this comment include test-only dependencies? (For example, something like It seems more clear how the the module graph gets so large for the current |
Yes, I believe so. |
Yes: golang/protobuf#806. |
Well, that was one source. There are apparently others. |
FWIW,
Separately, Bryan mentioned #26902 is potentially related. |
@dmitshur FYI, re-running the
(Perhaps better for this comment to be on golang/lint#436, but adding it here because golang/lint#436 is now a fairly high volume issue). Commandsmkdir /tmp/scratchpad/lint-test-workaround-rerun-1 cd /tmp/scratchpad/lint-test-workaround-rerun-1 export GOPATH=/tmp/scratchpad/gopath-for-lint-workaround-rerun-1 go mod init tempmod echo 'replace google.golang.org/grpc => google.golang.org/grpc v1.19.0' >> go.mod echo 'replace github.com/openzipkin/zipkin-go => github.com/openzipkin/zipkin-go b722d64 // current master' >> go.mod go get -u golang.org/x/lint |
Haven't looked at this carefully, but the
It looks like https://github.com/grpc-ecosystem/grpc-gateway released |
Question: could this be viewed as a non-fatal error? In the original example reported in golang/lint#436, I think there were other |
golint changed its import path [1], and that along with the advent of modules caused fallout [2, 3] that broke the `go get -u` installation in our makefile/CI build. The tools.go idiom is the currently favored approach for versioning development tools with the module system [4, 5], in a way that `go mod tidy` won't churn them from `go.mod` and the `+build` constraint keeps them out of actual build products. The tools still need to be `go install`ed, within a module `go get -u` is not the thing to do anymore because it upgrades transitive deps of a tool which may change the module's build. It takes like hours of reading discussions to triangulate on these moving targets... [5, 6, 7, 8] jfc how much of life have I spent following the fashion evolution of Go dependency management [1]: golang/lint@c363707 [2]: golang/go#30455 [3]: golang/go#30831 [4]: https://github.com/golang/go/wiki/Modules#how-can-i-track-tool-dependencies-for-a-module [5]: golang/go#25922 [6]: golang/go#27653 [7]: golang/go#27643 [8]: golang/go#30515
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#L7That latest version of the
github.com/openzipkin/zipkin-go
module is currentlyv0.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 badgrpc
version. Since-u
flag is used,go get
fetches the latest pseudo-version of thegithub.com/golang/lint
module, which is nowv0.0.0-20190227174305-5b3e6a55c961
and includes a go.mod file stating the module path to begolang.org/x/lint
, causing the error: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./cc @bcmills @jayconrod @matloob @thepudds
The text was updated successfully, but these errors were encountered: