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

Comments

Projects
None yet
2 participants
@bcmills
Copy link
Member

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/text@v0.0.0-20170915032832-14c0d48ead0c
rsc.io/quote rsc.io/quote/v3@v3.0.0
rsc.io/quote rsc.io/sampler@v1.3.0
rsc.io/sampler@v1.3.0 golang.org/x/text@v0.0.0-20170915032832-14c0d48ead0c
rsc.io/quote/v3@v3.0.0 rsc.io/sampler@v1.3.0

Note the spurious line:

rsc.io/quote golang.org/x/text@v0.0.0-20170915032832-14c0d48ead0c

Found while investigating #26474.

@bcmills bcmills added the NeedsFix label Jul 19, 2018

@bcmills bcmills added this to the Go1.11 milestone Jul 19, 2018

@bcmills bcmills added the modules label Jul 20, 2018

@gopherbot

This comment has been minimized.

Copy link

commented Jul 24, 2018

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

@gopherbot gopherbot closed this in f37ca81 Jul 28, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.