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: graph pruning not applied during 'go get' #55955

Open
bcmills opened this issue Sep 29, 2022 · 0 comments
Open

cmd/go: graph pruning not applied during 'go get' #55955

bcmills opened this issue Sep 29, 2022 · 0 comments
Assignees
Labels
GoCommand cmd/go modules NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@bcmills
Copy link
Member

bcmills commented Sep 29, 2022

(Found while investigating anacrolix/torrent#776.)

$ go version
go version devel go1.20-8d3631fcef Thu Sep 29 09:05:07 2022 +0000 linux/amd64

If I set GOPRIVATE=github.com/anacrolix and run go get github.com/anacrolix/dht/v2@v2.19.0, I get an invalid-version error for a pseudo-version that no longer exists (the commit may have been removed by a force-push).

$ export GOPRIVATE=github.com/anacrolix

$ go mod init example
go: creating new go.mod: module example

$ go get github.com/anacrolix/dht/v2@v2.19.0
go: downloading github.com/anacrolix/dht/v2 v2.19.0
go: downloading github.com/anacrolix/log v0.13.2-0.20220426014722-7b7d13a55d55
go: downloading github.com/anacrolix/missinggo/v2 v2.7.0
go: downloading github.com/anacrolix/chansync v0.3.0
go: downloading github.com/anacrolix/sync v0.4.0
go: downloading github.com/anacrolix/torrent v1.46.0
go: downloading github.com/bradfitz/iter v0.0.0-20191230175014-e8f45d346db8
go: downloading github.com/rs/dnscache v0.0.0-20210201191234-295bba877686
go: downloading golang.org/x/time v0.0.0-20210723032227-1f47c861a9ac
go: downloading github.com/anacrolix/multiless v0.2.1-0.20211218050420-533661eef5dc
go: downloading github.com/benbjohnson/immutable v0.3.0
go: downloading github.com/anacrolix/missinggo v1.3.0
go: downloading golang.org/x/sync v0.0.0-20210220032951-036812b2e83c
go: downloading github.com/anacrolix/stm v0.3.0
go: downloading github.com/anacrolix/missinggo/perf v1.0.0
go: downloading github.com/edsrzf/mmap-go v1.1.0
go: downloading golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e
go: downloading github.com/huandu/xstrings v1.3.2
go: github.com/anacrolix/dht/v2@v2.15.2-0.20220123034220-0538803801cb: invalid version: unknown revision 0538803801cb

However, if I run the same command using proxy.golang.org, the operation succeeds. That isn't surprising in and of itself, because the proxy has the pseudo-version cached. What is surprising is that the invalid version is not actually in the final module graph:

$ unset GOPRIVATE

$ go get github.com/anacrolix/dht/v2@v2.19.0
go: added github.com/anacrolix/chansync v0.3.0
go: added github.com/anacrolix/dht/v2 v2.19.0
go: added github.com/anacrolix/log v0.13.2-0.20220426014722-7b7d13a55d55
go: added github.com/anacrolix/missinggo v1.3.0
go: added github.com/anacrolix/missinggo/perf v1.0.0
go: added github.com/anacrolix/missinggo/v2 v2.7.0
go: added github.com/anacrolix/multiless v0.2.1-0.20211218050420-533661eef5dc
go: added github.com/anacrolix/stm v0.3.0
go: added github.com/anacrolix/sync v0.4.0
go: added github.com/anacrolix/torrent v1.46.0
go: added github.com/benbjohnson/immutable v0.3.0
go: added github.com/bradfitz/iter v0.0.0-20191230175014-e8f45d346db8
go: added github.com/edsrzf/mmap-go v1.1.0
go: added github.com/huandu/xstrings v1.3.2
go: added github.com/rs/dnscache v0.0.0-20210201191234-295bba877686
go: added golang.org/x/sync v0.0.0-20210220032951-036812b2e83c
go: added golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e
go: added golang.org/x/time v0.0.0-20210723032227-1f47c861a9ac

$ go mod graph | grep -o '[^ ]*dht[^ ]*' | sort -u
github.com/anacrolix/dht/v2@v2.16.2-0.20220311024416-dd658f18fd51
github.com/anacrolix/dht/v2@v2.19.0

If I clone the repo, check out v2.19.0, and run go mod tidy, it appears to be tidy and indeed does not depend in any way on v2.15.2-0.20220123034220-0538803801cb.

This suggests that there is a bug somewhere in go get that is causing it to follow dependency edges that should actually be pruned out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
GoCommand cmd/go modules NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

No branches or pull requests

1 participant