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 mod why fails to find import graph for github.com/golang/lint #32412

Closed
jaloren opened this issue Jun 3, 2019 · 4 comments
Closed

Comments

@jaloren
Copy link

jaloren commented Jun 3, 2019

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

go1.12.5 darwin/amd64

Does this issue reproduce with the latest release?

Yes

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

go env Output
GOARCH="amd64"
GOBIN="/Volumes/Repositories/go/bin"
GOCACHE="/Users/jlorenzini/Library/Caches/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Volumes/Repositories/go"
GOPROXY=""
GORACE=""
GOROOT="/usr/local/go"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/Users/jlorenzini/repos/dep/example.com/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/8w/7ndx_j6s36x9hm9dns67j21s3hynqn/T/go-build128423874=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

I have the following go.mod:

module example.com

require (
	github.com/BurntSushi/toml v0.3.1 // indirect
	github.com/Jeffail/gabs v1.1.1 // indirect
	github.com/SAP/go-hdb v0.13.1 // indirect
	github.com/SermoDigital/jose v0.9.1 // indirect
	github.com/StackExchange/wmi v0.0.0-20181212234831-e0a55b97c705 // indirect
	github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc // indirect
	github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf // indirect
	github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da // indirect
	github.com/armon/go-radix v0.0.0-20170727155443-1fca145dffbc // indirect
	github.com/asaskevich/govalidator v0.0.0-20180720115003-f9ffefc3facf // indirect
	github.com/aws/aws-lambda-go v1.8.2 // indirect
	github.com/aws/aws-sdk-go v1.13.54 // indirect
	github.com/beevik/ntp v0.2.0 // indirect
	github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973 // indirect
	github.com/bgentry/speakeasy v0.1.0 // indirect
	github.com/bitly/go-hostpool v0.0.0-20171023180738-a3a6125de932 // indirect
	github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869 // indirect
	github.com/cenkalti/backoff v2.0.0+incompatible // indirect
	github.com/coreos/go-systemd v0.0.0-20180202092358-40e2722dffea // indirect
	github.com/denisenkom/go-mssqldb v0.0.0-20181014144952-4e0d7dc8888f // indirect
	github.com/docker/distribution v0.0.0-20180522175653-f0cc92778478 // indirect
	github.com/docker/libtrust v0.0.0-20160708172513-aabc10ec26b7 // indirect
	github.com/dsnet/compress v0.0.1 // indirect
	github.com/duosecurity/duo_api_golang v0.0.0-20181024123116-92fea9203dbc // indirect
	github.com/f5devcentral/go-bigip v0.0.0-20180523221152-f965982c0fc1 // indirect
	github.com/fatih/color v1.7.0 // indirect
	github.com/fatih/structs v1.0.0 // indirect
	github.com/fsouza/go-dockerclient v1.3.1 // indirect
	github.com/go-ini/ini v1.41.0 // indirect
	github.com/go-ole/go-ole v1.2.2 // indirect
	github.com/go-sql-driver/mysql v1.4.1 // indirect
	github.com/go-yaml/yaml v2.1.0+incompatible // indirect
	github.com/gocql/gocql v0.0.0-20181023221251-2127b8d1a772 // indirect
	github.com/gofrs/uuid v3.2.0+incompatible // indirect
	github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db // indirect
	github.com/google/go-github v17.0.0+incompatible // indirect
	github.com/google/go-querystring v1.0.0 // indirect
	github.com/google/uuid v1.1.1 // indirect
	github.com/gopherjs/gopherjs v0.0.0-20181103185306-d547d1d9531e // indirect
	github.com/gotestyourself/gotestyourself v2.1.0+incompatible // indirect
	github.com/hashicorp/consul v1.1.0 // indirect
	github.com/hashicorp/go-cleanhttp v0.0.0-20171218145408-d5fe4b57a186 // indirect
	github.com/hashicorp/go-hclog v0.0.0-20181001195459-61d530d6c27f // indirect
	github.com/hashicorp/go-immutable-radix v1.0.0 // indirect
	github.com/hashicorp/go-memdb v0.0.0-20180223233045-1289e7fffe71 // indirect
	github.com/hashicorp/go-msgpack v0.0.0-20150518234257-fa3f63826f7c // indirect
	github.com/hashicorp/go-multierror v1.0.0 // indirect
	github.com/hashicorp/go-plugin v0.0.0-20181004024435-314501b665e0 // indirect
	github.com/hashicorp/go-rootcerts v0.0.0-20160503143440-6bb64b370b90 // indirect
	github.com/hashicorp/go-sockaddr v0.0.0-20180320115054-6d291a969b86 // indirect
	github.com/hashicorp/hcl v1.0.0 // indirect
	github.com/hashicorp/memberlist v0.1.0 // indirect
	github.com/hashicorp/serf v0.8.1 // indirect
	github.com/hashicorp/vault v0.9.1 // indirect
	github.com/heroku/docker-registry-client v0.0.0-20171019183014-fd2fe8034968 // indirect
	github.com/inconshreveable/mousetrap v1.0.0 // indirect
	github.com/jefferai/jsonx v0.0.0-20160721235117-9cc31c3135ee // indirect
	github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af // indirect
	github.com/jmoiron/sqlx v1.2.0 // indirect
	github.com/jtolds/gls v4.2.1+incompatible // indirect
	github.com/keybase/go-crypto v0.0.0-20181017165231-e696c8039bba // indirect
	github.com/konsorten/go-windows-terminal-sequences v1.0.2 // indirect
	github.com/kr/pretty v0.1.0 // indirect
	github.com/mattn/go-colorable v0.0.9 // indirect
	github.com/mattn/go-isatty v0.0.3 // indirect
	github.com/matttproud/golang_protobuf_extensions v1.0.0 // indirect
	github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b // indirect
	github.com/mgutz/logxi v0.0.0-20161027140823-aebf8a7d67ab // indirect
	github.com/mholt/archiver v3.1.1+incompatible // indirect
	github.com/miekg/dns v1.0.14 // indirect
	github.com/mitchellh/cli v0.0.0-20180414170447-c48282d14eba // indirect
	github.com/mitchellh/copystructure v0.0.0-20170525013902-d23ffcb85de3 // indirect
	github.com/mitchellh/go-homedir v0.0.0-20180523094522-3864e76763d9 // indirect
	github.com/mitchellh/mapstructure v1.1.2 // indirect
	github.com/mitchellh/reflectwalk v0.0.0-20170726202117-63d60e9d0dbc // indirect
	github.com/montanaflynn/stats v0.5.0 // indirect
	github.com/newrelic/infra-integrations-sdk v3.0.2+incompatible // indirect
	github.com/nwaples/rardecode v1.0.0 // indirect
	github.com/onrik/logrus v0.2.2 // indirect
	github.com/opentracing/opentracing-go v1.1.0 // indirect
	github.com/ory/dockertest v3.3.2+incompatible // indirect
	github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c // indirect
	github.com/patrickmn/go-cache v2.1.0+incompatible // indirect
	github.com/pierrec/lz4 v2.0.5+incompatible // indirect
	github.com/posener/complete v1.1.1 // indirect
	github.com/prometheus/client_golang v0.8.0 // indirect
	github.com/prometheus/client_model v0.0.0-20171117100541-99fa1f4be8e5 // indirect
	github.com/prometheus/common v0.0.0-20180518154759-7600349dcfe1 // indirect
	github.com/prometheus/procfs v0.0.0-20180408092902-8b1c2da0d56d // indirect
	github.com/ryanuber/go-glob v0.0.0-20170128012129-256dc444b735 // indirect
	github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529 // indirect
	github.com/sethgrid/pester v0.0.0-20180430140037-03e26c9abbbf // indirect
	github.com/shirou/gopsutil v2.18.10+incompatible // indirect
	github.com/shirou/w32 v0.0.0-20160930032740-bb4de0191aa4 // indirect
	github.com/sirupsen/logrus v1.3.0 // indirect
	github.com/smartystreets/assertions v0.0.0-20190116191733-b6c0e53d7304 // indirect
	github.com/smartystreets/goconvey v0.0.0-20181108003508-044398e4856c // indirect
	github.com/spf13/cobra v0.0.3 // indirect
	github.com/spf13/pflag v1.0.3 // indirect
	github.com/stretchr/testify v1.3.0 // indirect
	github.com/xi2/xz v0.0.0-20171230120015-48954b6210f8 // indirect
	golang.org/x/crypto v0.0.0-20190228161510-8dd112bcdc25 // indirect
	golang.org/x/oauth2 v0.0.0-20181017192945-9dcd33a902f4 // indirect
	golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4 // indirect
	golang.org/x/sys v0.0.0-20190228124157-a34e9553db1e // indirect
	google.golang.org/grpc v1.16.0 // indirect
	gopkg.in/alecthomas/kingpin.v2 v2.2.6 // indirect
	gopkg.in/couchbase/gocb.v1 v1.6.1 // indirect
	gopkg.in/couchbase/gocbcore.v7 v7.1.13 // indirect
	gopkg.in/couchbaselabs/gocbconnstr.v1 v1.0.2 // indirect
	gopkg.in/couchbaselabs/gojcbmock.v1 v1.0.3 // indirect
	gopkg.in/couchbaselabs/jsonx.v1 v1.0.0 // indirect
	gopkg.in/ini.v1 v1.41.0 // indirect
	gopkg.in/mgo.v2 v2.0.0-20180705113604-9856a29383ce // indirect
	gopkg.in/natefinch/lumberjack.v2 v2.0.0 // indirect
	gopkg.in/ory-am/dockertest.v3 v3.3.2 // indirect
	gopkg.in/vmihailenco/msgpack.v2 v2.9.1 // indirect
	gopkg.in/yaml.v2 v2.2.2 // indirect
	labix.org/v2/mgo v0.0.0-20140701140051-000000000287 // indirect
	launchpad.net/gocheck v0.0.0-20140225173054-000000000087 // indirect
)

If run go get -u, it fails with the following error:

go: github.com/golang/[email protected]: parsing go.mod: unexpected module path "golang.org/x/lint"

This is because of #30831. So then I was curious about why go get was trying to update so I did the following

jlorenzini@jlorenzini-mb example.com$ go mod why -m github.com/golang/lint
# github.com/golang/lint
(main module does not need module github.com/golang/lint)

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 upgrade github.com/golang/lint but go mod why says my main module does not have a dependency on that module.

@jaloren
Copy link
Author

jaloren commented Jun 4, 2019

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/[email protected] github.com/golang/[email protected]
google.golang.org/[email protected] golang.org/x/[email protected]
jlorenzini@jlorenzini-mb operator$ go mod why google.golang.org/[email protected]
go: finding github.com/golang/protobuf/proto/testdata latest
go: finding github.com/golang/protobuf/proto latest
# google.golang.org/[email protected]
(main module does not need package google.golang.org/[email protected])

@bcmills
Copy link
Contributor

bcmills commented Jun 6, 2019

Duplicate of #27900

@bcmills bcmills marked this as a duplicate of #27900 Jun 6, 2019
@bcmills bcmills closed this as completed Jun 6, 2019
@bcmills
Copy link
Contributor

bcmills commented Jun 6, 2019

(Also note that if you want to answer the question “why this module?” rather than “why this package?”, you want go mod why -m.)

@bcmills
Copy link
Contributor

bcmills commented Jun 6, 2019

And #26902 should make get -u much less aggressive about upgrading things that aren't actually in your package-import graph.

@golang golang locked and limited conversation to collaborators Jun 5, 2020
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