Navigation Menu

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: 1.16 changes 'go list -m all' behavior #44238

Closed
qbit opened this issue Feb 12, 2021 · 5 comments
Closed

cmd/go: 1.16 changes 'go list -m all' behavior #44238

qbit opened this issue Feb 12, 2021 · 5 comments
Labels
FrozenDueToAge modules NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Milestone

Comments

@qbit
Copy link
Member

qbit commented Feb 12, 2021

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

1.16rc1

Does this issue reproduce with the latest release?

In versions <= 1.15 one was able to download a packages go.mod file and use go list -m all to print a full set of dependencies. All beta and rc versions of 1.16 have suffered from this issue.

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

Confirmed on darwin/arm64 and openbsd/amd64,arm65

What did you do?

mkdir /tmp/test
cd /tmp/test
curl -o go.mod https://proxy.golang.org/suah.dev/protect/@v/v1.0.0.mod
go list -m all

What did you expect to see?

qbit@tal[0]:/tmp/test$ go list -m all                                                         
suah.dev/protect
golang.org/x/sys v0.0.0-20200501145240-bc7a7d42d5c3
qbit@tal[0]:/tmp/test$ 

What did you see instead?

qbit@plq[0]:/tmp/test% go list -m all
go: golang.org/x/sys@v0.0.0-20200501145240-bc7a7d42d5c3: missing go.sum entry; to add it:
	go mod download golang.org/x/sys
qbit@plq[1]:/tmp/test% 

Adding -mod=mod makes go list -m all produce the expected output.

@mvdan
Copy link
Member

mvdan commented Feb 12, 2021

I think this is because go list -m all in 1.16 roughly equals go list -m -mod=readonly in 1.15. An alternative to adding -mod=mod would be to run go mod tidy to ensure go.mod and go.sum aren't missing any lines.

@seankhliao seankhliao changed the title 1.16 changes 'go list -m all' behavior cmd/go: 1.16 changes 'go list -m all' behavior Feb 12, 2021
@seankhliao seankhliao added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Feb 12, 2021
@bcmills
Copy link
Contributor

bcmills commented Feb 12, 2021

This is an expected consequence of #40728.

There are several ways to mitigate it:

  • In the steps to reproduce, copy the project's go.sum file in addition to its go.mod file.
  • Or, run go mod download, go mod tidy, or go mod vendor after copying in the go.mod file.
  • Or, if you are copying the go.mod file in order to build some package, run go get -d on that package in order to fetch checksums for its dependencies.
  • Or, pass -mod=mod explicitly to the go list command, to inform it that you really are ok with going out to the network to fetch checksums.

(CC @jayconrod @matloob)

@bcmills
Copy link
Contributor

bcmills commented Feb 12, 2021

@qbit: taking the above options into account, do you have a specific workflow that this workflow makes awkward or difficult?

(If so, we can look for other mitigations — or perhaps other changes to -mod=readonly mode, or better documentation — to address that workflow.)

@bcmills bcmills added modules WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. labels Feb 12, 2021
@bcmills bcmills modified the milestones: Backlog, Unplanned Feb 12, 2021
@qbit
Copy link
Member Author

qbit commented Feb 12, 2021

In my case adding -mod=mod seems to be the best approach.

For context, this is for the OpenBSD portgen utility, which builds a port (think software packaging) of go tools. I am using go list -m all to get a list of all dependencies for inclusion in a port's distribution file list (for example, here is the distinfo file for the age port).

Thanks for the info!

@bcmills
Copy link
Contributor

bcmills commented Feb 12, 2021

Thanks! In that case, I'm going to close this as “worked as proposed in #40728”, but please do let us know if you run into other cases that can't easily be fixed.

@bcmills bcmills closed this as completed Feb 12, 2021
@golang golang locked and limited conversation to collaborators Feb 12, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge modules NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Projects
None yet
Development

No branches or pull requests

5 participants