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: why go get will add indirect dependency into go.mod #35080

Closed
Sherlock-Holo opened this issue Oct 22, 2019 · 1 comment
Closed

cmd/go: why go get will add indirect dependency into go.mod #35080

Sherlock-Holo opened this issue Oct 22, 2019 · 1 comment

Comments

@Sherlock-Holo
Copy link

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

$ go version
go 1.13.3

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=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/sherlock/.cache/go-build"
GOENV="/home/sherlock/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/sherlock/go"
GOPRIVATE=""
GOPROXY="https://goproxy.cn,direct"
GOROOT="/usr/lib/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/lib/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/home/sherlock/git/tfs/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-build601688037=/tmp/go-build -gno-record-gcc-switches"

What did you do?

My go.mod file content has some indirect dependencies, like

github.com/spf13/pflag v1.0.5 // indirect
golang.org/x/net v0.0.0-20190921015927-1a5e07d1ff72 // indirect
golang.org/x/sys v0.0.0-20191002091554-b397fe3ad8ed // indirect
golang.org/x/text v0.3.2 // indirect
google.golang.org/genproto v0.0.0-20190916214212-f660b8655731 // indirect

I delete them and then run go mod tidy

What did you expect to see?

What did you see instead?

go doesn't add them back and delete them from go.sum

So it confuses me: if go mod tidy doesn't add them back, and go build successfully, why I run go get -v github.com/something/something will add something indirect dependencies

@bcmills
Copy link
Contributor

bcmills commented Oct 22, 2019

This issue seems to be a question about how to use Go, rather than a feature request or defect report about the Go language and/or toolchain.

We have decided that our experiment to allow questions on the issue tracker has not had the outcome we desired, so I am closing this issue. I'm sorry that we can't answer your question here.

There are many other methods to get help if you're still looking for answers:

Thanks

@bcmills bcmills closed this as completed Oct 22, 2019
@golang golang locked and limited conversation to collaborators Oct 21, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants