Skip to content

cmd/go: go list should not add a dependency to go.mod #37197

Closed
@glinton

Description

@glinton

Possibly related to #36812
Re-open of #28014 which was not a duplicate of 27643

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

$ go version
go version go1.13.7 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=""
GOCACHE="/home/me/.cache/go-build"
GOENV="/home/me/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/opt/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/opt/local/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/tmp/listTest/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-build352932148=/tmp/go-build -gno-record-gcc-switches"

What did you do?

mkdir /tmp/listTest
cd /tmp/listTest

go mod init test
# go: creating new go.mod: module test

cat go.mod
# module test
# 
# go 1.13

go list github.com/golang/protobuf/proto
# github.com/golang/protobuf/proto

cat go.mod
# module test
# 
# go 1.13
# 
# require github.com/golang/protobuf v1.3.3 // indirect

go mod tidy

cat go.mod 
# module test
# 
# go 1.13

What did you expect to see?

I expected to see if the package argument to go list was present in my go environment. No file writes.

What did you see instead?

I saw that the package argument to go list was present, but I also saw an intrusive update to my go.mod.

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeNeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.WaitingForInfoIssue is not actionable because of missing required information, which needs to be provided.modules

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions