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: ignore unused modules more intelligently. #41562

Closed
nrvnrvn opened this issue Sep 22, 2020 · 2 comments
Closed

cmd/go: ignore unused modules more intelligently. #41562

nrvnrvn opened this issue Sep 22, 2020 · 2 comments

Comments

@nrvnrvn
Copy link
Contributor

nrvnrvn commented Sep 22, 2020

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

$ go version
go version go1.15.1 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
$ go env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/nick.revin/Library/Caches/go-build"
GOENV="/Users/nick.revin/Library/Application Support/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOINSECURE=""
GOMODCACHE="/Users/nick.revin/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Users/nick.revin/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/Cellar/go/1.15.1/libexec"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/Cellar/go/1.15.1/libexec/pkg/tool/darwin_amd64"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD=""
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/zq/pjk9rp297blc98tc4phgv6b80000gp/T/go-build258952378=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

Tried to verify and tidy go modules.

The background:
One of the direct dependencies of the project has an indirect dependency of bitbucket.org/ww/goautoneg but it turns out that this project has been removed/abandoned recently.

Moreover, all the dependencies are vendored and despite the fact that operator-sdk requires a whole chain of its own dependencies the aforementioned bitbucket.org/ww/goautoneg is not actually needed or used since I can't find it in the vendor directory.

Thus the project can be built without issues because all the dependency requirements are met but the go mod commands are not working since they cannot find the repository with bitbucket.org/ww/goautoneg

This issue looks similar to #26602 but the problem is more subtle. While one of the declared indirect dependencies is actually missing we are not using it anyway.

This change https://go-review.googlesource.com/c/go/+/255960/ introduces the -e flag to mod tidy and mod vendor commands

It would be great to allow similar best effort strategy for other go mod subcommands. Because currently if some indirect dependency cannot be loaded or resolved none of the commands can be used. They just print out the failing subtree and exit.

What did you expect to see?

$ go mod verify -e
not all modules verified
go: github.com/operator-framework/operator-sdk@v0.10.0 requires
	github.com/operator-framework/operator-lifecycle-manager@v0.0.0-20190128024246-5eb7ae5bdb7a requires
	github.com/operator-framework/operator-registry@v1.0.4 requires
	github.com/operator-framework/operator-lifecycle-manager@v0.0.0-20190105193533-81104ffdc4fb requires
	bitbucket.org/ww/goautoneg@v0.0.0-20120707110453-75cd24fc2f2c: reading https://api.bitbucket.org/2.0/repositories/ww/goautoneg?fields=scm: 404 Not Found
$ # does best effort package verification ignoring the failing path.

What did you see instead?

$ go mod verify
go: github.com/operator-framework/operator-sdk@v0.10.0 requires
	github.com/operator-framework/operator-lifecycle-manager@v0.0.0-20190128024246-5eb7ae5bdb7a requires
	github.com/operator-framework/operator-registry@v1.0.4 requires
	github.com/operator-framework/operator-lifecycle-manager@v0.0.0-20190105193533-81104ffdc4fb requires
	bitbucket.org/ww/goautoneg@v0.0.0-20120707110453-75cd24fc2f2c: reading https://api.bitbucket.org/2.0/repositories/ww/goautoneg?fields=scm: 404 Not Found
@bcmills
Copy link
Contributor

bcmills commented Sep 22, 2020

Duplicate of #36460

@bcmills bcmills marked this as a duplicate of #36460 Sep 22, 2020
@bcmills bcmills closed this as completed Sep 22, 2020
@bcmills
Copy link
Contributor

bcmills commented Sep 22, 2020

(That issue has been basically my main project for the year, and this example is exactly the kind of use-case we intend to address with it.)

@golang golang locked and limited conversation to collaborators Sep 22, 2021
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