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: go mod -graph erroneously lists edges from the main module to indirect dependencies #26489

Closed
bcmills opened this issue Jul 19, 2018 · 1 comment
Labels
FrozenDueToAge modules NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@bcmills
Copy link
Contributor

bcmills commented Jul 19, 2018

In modload, we intentionally treat the main module as requiring the entire build list. (I don't recall why, but we do.)

list = append(list, r.buildList[1:]...)

Unfortunately, that interacts badly with go mod -graph, which fails to take the extra requirements into account. We end up printing spurious edges from the main module to all of its transitive dependencies.

$ cd $(mktemp -d)

$ go version
go version devel +f8f3e3a3b4 Thu Jul 19 14:17:14 2018 -0400 linux/amd64

$ git clone https://github.com/rsc/quote.git .
Cloning into '.'...
remote: Counting objects: 80, done.
remote: Total 80 (delta 0), reused 0 (delta 0), pack-reused 80
Unpacking objects: 100% (80/80), done.

$ cat go.mod
module rsc.io/quote

require (
        rsc.io/quote/v3 v3.0.0
        rsc.io/sampler v1.3.0
)

$ go mod -graph
go: finding rsc.io/sampler v1.3.0
go: finding rsc.io/quote/v3 v3.0.0
rsc.io/quote golang.org/x/[email protected]
rsc.io/quote rsc.io/quote/[email protected]
rsc.io/quote rsc.io/[email protected]
rsc.io/[email protected] golang.org/x/[email protected]
rsc.io/quote/[email protected] rsc.io/[email protected]

Note the spurious line:

rsc.io/quote golang.org/x/[email protected]

Found while investigating #26474.

@bcmills bcmills added the NeedsFix The path to resolution is known, but the work has not been done. label Jul 19, 2018
@bcmills bcmills added this to the Go1.11 milestone Jul 19, 2018
@gopherbot
Copy link
Contributor

Change https://golang.org/cl/125657 mentions this issue: cmd/go: fix spurious edges in mod -graph output

@golang golang locked and limited conversation to collaborators Jul 28, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge modules NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

No branches or pull requests

2 participants