Closed jaloren closed 5 years ago
I was able to narrow this down using go mod graph. Looks like the issue is related to grpc. Grpc is a transitive dependency. and if i do a go mod why on that it also says the main module does not depend on it.
jlorenzini@jlorenzini-mb operator$ go mod graph | grep lint
google.golang.org/grpc@v1.16.0 github.com/golang/lint@v0.0.0-20180702182130-06c8688daad7
google.golang.org/grpc@v1.16.0 golang.org/x/lint@v0.0.0-20180702182130-06c8688daad7
jlorenzini@jlorenzini-mb operator$ go mod why google.golang.org/grpc@v1.16.0
go: finding github.com/golang/protobuf/proto/testdata latest
go: finding github.com/golang/protobuf/proto latest
# google.golang.org/grpc@v1.16.0
(main module does not need package google.golang.org/grpc@v1.16.0)
Duplicate of #27900
(Also note that if you want to answer the question “why this module?” rather than “why this package?”, you want go mod why -m
.)
And #26902 should make get -u
much less aggressive about upgrading things that aren't actually in your package-import graph.
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
I have the following go.mod:
If run
go get -u
, it fails with the following error:This is because of https://github.com/golang/go/issues/30831. So then I was curious about why go get was trying to update so I did the following
Note it does not matter what go source code you have in the repo.
What did you expect to see?
Either go mod why says its not in use therefore go get -u shouldn't have been trying to upgrade it or go get -u does not try to update it because go mod why says its not in use.
What did you see instead?
go get -u
tried to upgradegithub.com/golang/lint
but go mod why says my main module does not have a dependency on that module.