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: -mod=readonly causes go install p@version to fail with "missing go.sum entry" #43278

Closed
eliasnaur opened this issue Dec 19, 2020 · 3 comments
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done. release-blocker
Milestone

Comments

@eliasnaur
Copy link
Contributor

From https://groups.google.com/g/golang-nuts/c/XeQhJghJGPs

I have GOFLAGS=-mod=readonly in my environment to avoid unnoticed changes to go.mod and go.sum. However, I'm getting a weird error from the (new in 1.16) go install p@version form to install a Go program:

$ cd $(mktemp -d)
$ GOFLAGS=-mod=readonly go install gioui.org/cmd/gogio@40c082e94961adaf55886b45710a54d0247ff1bf
go install gioui.org/cmd/gogio@40c082e94961adaf55886b45710a54d0247ff1bf: gioui.org/c...@v0.0.0-20201218091821-40c082e94961: missing go.sum entry

Clearing GOFLAGS does work:

$ GOFLAGS= go install gioui.org/cmd/gogio@40c082e94961adaf55886b45710a54d0247ff1bf
go: downloading gioui.org v0.0.0-20201218091821-40c082e94961
go: downloading gioui.org/cmd v0.0.0-20201218091821-40c082e94961

I can't explain the difference, nor the error. In case it makes a difference, I have a checkout of gioui.org/cmd/gogio at the above revision where go mod tidy is a no-op.

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

$ go version
go version devel +2de7866470 Fri Dec 18 18:25:14 2020 +0000 darwin/amd64

Does this issue reproduce with the latest release?

Yes

@seankhliao
Copy link
Member

seankhliao commented Dec 19, 2020

go mod tidy removes 2 lines from go.sum at that checkout I looked at the repo root and not the nested module in cmd/

@jayconrod jayconrod added the NeedsFix The path to resolution is known, but the work has not been done. label Dec 21, 2020
@jayconrod jayconrod added this to the Go1.16 milestone Dec 21, 2020
@jayconrod jayconrod self-assigned this Dec 21, 2020
@jayconrod
Copy link
Contributor

Reproduced in 1.16beta1. Thanks for reporting!

@gopherbot
Copy link

Change https://golang.org/cl/279490 mentions this issue: cmd/go: set cfg.BuildMod to "readonly" by default with no module root

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

No branches or pull requests

5 participants
@jayconrod @eliasnaur @gopherbot @seankhliao and others