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: spurious "missing go.sum entry" errors #63914

Closed
rogpeppe opened this issue Nov 2, 2023 · 3 comments
Closed

cmd/go: spurious "missing go.sum entry" errors #63914

rogpeppe opened this issue Nov 2, 2023 · 3 comments
Labels
GoCommand cmd/go NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@rogpeppe
Copy link
Contributor

rogpeppe commented Nov 2, 2023

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

$ go version
go version devel go1.22-54452b963c Thu Nov 2 10:34:00 2023 +0000 linux/amd64

Does this issue reproduce with the latest release?

Yes (Go 1.21)

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

go env Output
$ go env

What did you do?

Ran this testscript script:

exec go mod tidy
exec go test github.com/opencontainers/distribution-spec/conformance
-- test.go --
package test

import _ "github.com/opencontainers/distribution-spec/conformance"
-- go.mod --
module test

go 1.20

require github.com/opencontainers/distribution-spec/conformance v0.0.0-20231101194043-f2182352d4cc

require (
	github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 // indirect
	github.com/bloodorangeio/reggie v0.6.1 // indirect
	github.com/go-logr/logr v1.2.4 // indirect
	github.com/go-resty/resty/v2 v2.7.0 // indirect
	github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 // indirect
	github.com/google/pprof v0.0.0-20230602150820-91b7bce49751 // indirect
	github.com/google/uuid v1.3.0 // indirect
	github.com/mitchellh/mapstructure v1.5.0 // indirect
	github.com/onsi/ginkgo/v2 v2.11.0 // indirect
	github.com/opencontainers/go-digest v1.0.0 // indirect
	github.com/stretchr/testify v1.7.0 // indirect
	golang.org/x/net v0.16.0 // indirect
	golang.org/x/sys v0.13.0 // indirect
	golang.org/x/tools v0.14.0 // indirect
)
-- go.sum --
github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 h1:DklsrG3dyBCFEj5IhUbnKptjxatkF07cF2ak3yi77so=
github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2/go.mod h1:WaHUgvxTVq04UNunO+XhnAqY/wQc+bxr74GqbsZ/Jqw=
github.com/bloodorangeio/reggie v0.6.1 h1:rSpfPN8oU9kflRI7aQVjImjhY5meRsXDIXnJQrr11zs=
github.com/bloodorangeio/reggie v0.6.1/go.mod h1:Jkvg7UBdlXVNOlvXU6hgysdtG1XNVCB3B4/k7+PtlfM=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ=
github.com/go-logr/logr v1.2.4/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A=
github.com/go-resty/resty/v2 v2.7.0 h1:me+K9p3uhSmXtrBZ4k9jcEAfJmuC8IivWHwaLZwPrFY=
github.com/go-resty/resty/v2 v2.7.0/go.mod h1:9PWDzw47qPphMRFfhsyk0NnSgvluHcljSMVIq3w7q0I=
github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 h1:tfuBGBXKqDEevZMzYi5KSi8KkcZtzBcTgAUUtapy0OI=
github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572/go.mod h1:9Pwr4B2jHnOSGXyyzV8ROjYa2ojvAY6HCGYYfMoC3Ls=
github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg=
github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38=
github.com/google/pprof v0.0.0-20230602150820-91b7bce49751 h1:hR7/MlvK23p6+lIw9SN1TigNLn9ZnF3W4SYRKq2gAHs=
github.com/google/pprof v0.0.0-20230602150820-91b7bce49751/go.mod h1:Jh3hGz2jkYak8qXPD19ryItVnUgpgeqzdkY/D0EaeuA=
github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I=
github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY=
github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo=
github.com/onsi/ginkgo/v2 v2.11.0 h1:WgqUCUt/lT6yXoQ8Wef0fsNn5cAuMK7+KT9UFRz2tcU=
github.com/onsi/ginkgo/v2 v2.11.0/go.mod h1:ZhrRA5XmEE3x3rhlzamx/JJvujdZoJ2uvgI7kR0iZvM=
github.com/onsi/gomega v1.27.8 h1:gegWiwZjBsf2DgiSbf5hpokZ98JVDMcWkUiigk6/KXc=
github.com/opencontainers/distribution-spec/conformance v0.0.0-20231101194043-f2182352d4cc h1:jL+CgYEEZluGb08ZcLpEyhn389kNMlwrWOHaIqXazq0=
github.com/opencontainers/distribution-spec/conformance v0.0.0-20231101194043-f2182352d4cc/go.mod h1:odnkI+gfnNSdq8NaG/nKvENDEWkXAjjbgp8GKMllVSI=
github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U=
github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY=
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
golang.org/x/mod v0.13.0 h1:I/DsJXRlw/8l/0c24sM9yb0T4z9liZTduXvdAWYiysY=
golang.org/x/net v0.0.0-20211029224645-99673261e6eb/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.16.0 h1:7eBu7KsSvFDtSXUIDbh3aqlK4DPsZ1rByC8PFfBThos=
golang.org/x/net v0.16.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE=
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE=
golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.14.0 h1:jvNa2pY0M4r62jkRQ6RwEZZyPcymeL9XZMLBbV7U2nc=
golang.org/x/tools v0.14.0/go.mod h1:uYBEerGOWcJyEORxN+Ek8+TT266gXkNlHdJBwexUsBg=
google.golang.org/protobuf v1.28.0 h1:w43yiav+6bVFTBQFZX0r7ipe9JQ1QsbMgHwbBziscLw=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=

What did you expect to see?

A passing test.

What did you see instead?

> exec go mod tidy
> exec go test github.com/opencontainers/distribution-spec/conformance
[stdout]
FAIL	github.com/opencontainers/distribution-spec/conformance [setup failed]
FAIL
[stderr]
# github.com/opencontainers/distribution-spec/conformance
/home/rogpeppe/src/go/pkg/mod/github.com/opencontainers/distribution-spec/conformance@v0.0.0-20231101194043-f2182352d4cc/00_conformance_suite_test.go:8:2: github.com/onsi/gomega@v1.27.8: missing go.sum entry for go.mod file; to add it:
	go mod download github.com/onsi/gomega
[exit status 1]
FAIL: /tmp/testscript3651662544/workbug2.txtar/script.txtar:2: unexpected command failure

It suggests that there's a missing go.sum entry, but go mod tidy should have been enough to create that.

Interestingly, following the instructions provided in the error message lead us down a little rabbit hole:

% go test github.com/opencontainers/distribution-spec/conformance
# github.com/opencontainers/distribution-spec/conformance
/home/rogpeppe/src/go/pkg/mod/github.com/opencontainers/distribution-spec/conformance@v0.0.0-20231101194043-f2182352d4cc/00_conformance_suite_test.go:8:2: github.com/onsi/gomega@v1.27.8: missing go.sum entry for go.mod file; to add it:
	go mod download github.com/onsi/gomega
FAIL	github.com/opencontainers/distribution-spec/conformance [setup failed]
FAIL
% 	go mod download github.com/onsi/gomega
% go test github.com/opencontainers/distribution-spec/conformance
# github.com/opencontainers/distribution-spec/conformance
/home/rogpeppe/src/go/pkg/mod/github.com/onsi/gomega@v1.27.8/matchers.go:6:2: github.com/google/go-cmp@v0.5.9: missing go.sum entry for go.mod file; to add it:
	go mod download github.com/google/go-cmp
FAIL	github.com/opencontainers/distribution-spec/conformance [setup failed]
FAIL
% go mod download github.com/google/go-cmp
% go test github.com/opencontainers/distribution-spec/conformance
# github.com/opencontainers/distribution-spec/conformance
/home/rogpeppe/src/go/pkg/mod/golang.org/x/net@v0.16.0/html/charset/charset.go:20:2: golang.org/x/text@v0.13.0: missing go.sum entry for go.mod file; to add it:
	go mod download golang.org/x/text
FAIL	github.com/opencontainers/distribution-spec/conformance [setup failed]
FAIL
% go mod download golang.org/x/text
% go test github.com/opencontainers/distribution-spec/conformance
# github.com/opencontainers/distribution-spec/conformance
/home/rogpeppe/src/go/pkg/mod/github.com/onsi/gomega@v1.27.8/matchers/match_yaml_matcher.go:8:2: gopkg.in/yaml.v3@v3.0.1: missing go.sum entry for go.mod file; to add it:
	go mod download gopkg.in/yaml.v3
FAIL	github.com/opencontainers/distribution-spec/conformance [setup failed]
FAIL
% go mod download gopkg.in/yaml.v3
% go test github.com/opencontainers/distribution-spec/conformance
panic: Address is required
... this panic is expected and nothing to do with this issue

If we run go mod tidy again, we end up back where we started:

% go mod tidy
% github.com/opencontainers/distribution-spec/conformance
# github.com/opencontainers/distribution-spec/conformance
/home/rogpeppe/src/go/pkg/mod/github.com/opencontainers/distribution-spec/conformance@v0.0.0-20231101194043-f2182352d4cc/00_conformance_suite_test.go:8:2: github.com/onsi/gomega@v1.27.8: missing go.sum entry for go.mod file; to add it:
	go mod download github.com/onsi/gomega
FAIL	github.com/opencontainers/distribution-spec/conformance [setup failed]
@cherrymui cherrymui added GoCommand cmd/go NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. labels Nov 2, 2023
@cherrymui cherrymui added this to the Backlog milestone Nov 2, 2023
@cherrymui
Copy link
Member

cc @bcmills @matloob

@bcmills
Copy link
Member

bcmills commented Nov 2, 2023

Duplicate of #56222

@bcmills bcmills marked this as a duplicate of #56222 Nov 2, 2023
@bcmills bcmills closed this as not planned Won't fix, can't repro, duplicate, stale Nov 2, 2023
@bcmills
Copy link
Member

bcmills commented Nov 2, 2023

@rogpeppe, you should find that bumping the go version in your go.mod file to go 1.21 or higher causes go mod tidy to save the needed checksum.

@bcmills bcmills modified the milestones: Backlog, Go1.21 Nov 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
GoCommand cmd/go 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

3 participants