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: list modifies local go.sum even when package does not exist in queried module #36260

Open
kortschak opened this issue Dec 24, 2019 · 3 comments

Comments

@kortschak
Copy link
Contributor

@kortschak kortschak commented Dec 24, 2019

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

$ go version
go version go1.13.5 linux/amd64

Does this issue reproduce with the latest release?

Yes.

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

go env Output
$ go env
GO111MODULE="on"
GOARCH="amd64"
GOBIN="/home/user/bin"
GOCACHE="/home/user/.cache/go-build"
GOENV="/home/user/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/user"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/home/user/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/home/user/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/home/user/tmp/go.mod"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build218352463=/tmp/go-build -gno-record-gcc-switches"

What did you do?

~ $ mkdir tmp
~ $ cd tmp
~/tmp $ go mod init module
go: creating new go.mod: module module
~/tmp $ stat go.sum
stat: cannot stat 'go.sum': No such file or directory
~/tmp $ go list golang.org/x/tools/nonexistent
go: finding golang.org/x/tools latest
can't load package: package golang.org/x/tools/nonexistent: module golang.org/x/tools@latest found (v0.0.0-20191223235410-3721262b3e7c), but does not contain package golang.org/x/tools/nonexistent
~/tmp $ cat go.sum
golang.org/x/tools v0.0.0-20191223235410-3721262b3e7c h1:PeFrxQ8YTAKg53UR8aP/nxa82lQYIdb+pd1bfg3dBDM=

What did you expect to see?

No change to go.sum.

What did you see instead?

An addition to go.sum.

@cagedmantis cagedmantis added this to the Backlog milestone Jan 2, 2020
@cagedmantis
Copy link
Contributor

@cagedmantis cagedmantis commented Jan 2, 2020

@kortschak Thanks for creating an issue. I've been able to reproduce what you've described.

@cagedmantis
Copy link
Contributor

@cagedmantis cagedmantis commented Jan 2, 2020

@bcmills bcmills added the modules label Jan 6, 2020
@gopherbot
Copy link

@gopherbot gopherbot commented Jun 8, 2020

Change https://golang.org/cl/237017 mentions this issue: cmd/go: don't save sums for modules loaded for import resolution

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants
You can’t perform that action at this time.