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/cover: accept -mod=vendor as an explicit flag #31018

Closed
dlip opened this issue Mar 25, 2019 · 6 comments
Closed

cmd/cover: accept -mod=vendor as an explicit flag #31018

dlip opened this issue Mar 25, 2019 · 6 comments
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@dlip
Copy link

dlip commented Mar 25, 2019

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

$ go version
go version go1.12.1 darwin/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
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/lipscoda/Library/Caches/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/lipscoda/workspace/code"
GOPROXY=""
GORACE=""
GOROOT="/usr/local/Cellar/go/1.12.1/libexec"
GOTMPDIR=""
GOTOOLDIR="/usr/local/Cellar/go/1.12.1/libexec/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/Users/lipscoda/workspace/code_archive/docker.appspace.api/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 -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/m0/5_69c64x3110wqw6mv5kr934h0n8s5/T/go-build218403268=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

I am using modules with a vendor folder, when i try to run go tool cover it attempts to connect to the internet to download the dependencies.

What did you expect to see?

Cover to succeed without an internet connection

What did you see instead?

cover: cannot run go list: exit status 1
go: gopkg.in/src-d/go-git.v4@v4.10.0: unrecognized import path "gopkg.in/src-d/go-git.v4" (https fetch: Get https://gopkg.in/src-d/go-git.v4?go-get=1: dial tcp: lookup gopkg.in on 192.168.65.1:53: no such host)
go: k8s.io/client-go@v10.0.0+incompatible: unrecognized import path "k8s.io/client-go" (https fetch: Get https://k8s.io/client-go?go-get=1: dial tcp: lookup k8s.io on 192.168.65.1:53: no such host)
...
@bcmills
Copy link
Contributor

bcmills commented Apr 12, 2019

What was the exact command you ran? (Your go env output shows an empty GOFLAGS, so how were you passing -mod=vendor to go tool cover?)

@bcmills bcmills added the WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. label Apr 12, 2019
@mhr3
Copy link

mhr3 commented Apr 12, 2019

Fwiw we had the same issue, and really we just weren't aware that the go tool cover invocation will use flags from GOFLAGS envvar, and expected an explicit -mod flag for the tool. Maybe something to clarify in -help?

@dlip
Copy link
Author

dlip commented Apr 12, 2019

Because go tool cover was calling go list without any arguments I was getting that error, being new to go I wasn't aware of the GOFLAGS env var could set global flags. I'm ok using GOFLAGS now but maybe you could consider adding the -mod flag to go tool since it calls other tools that may require it.

@bcmills bcmills changed the title Go tool cover doesn't support -mod vendor cmd/cover: accept -mod=vendor as an explicit flag Apr 13, 2019
@bcmills bcmills added NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. and removed WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. labels Apr 13, 2019
@bcmills bcmills added this to the Go1.13 milestone Apr 13, 2019
@bcmills
Copy link
Contributor

bcmills commented Apr 13, 2019

See also #27841 (comment).

@gopherbot
Copy link

Change https://golang.org/cl/170863 mentions this issue: cmd/gopherbot: CC triaged issues to owners

@dlip
Copy link
Author

dlip commented Apr 17, 2019

Picking up the vendor folder by default could also remove the need to pass the flag through. See #27227

@andybons andybons modified the milestones: Go1.13, Go1.14 Jul 8, 2019
@rsc rsc modified the milestones: Go1.14, Backlog Oct 9, 2019
@dlip dlip closed this as not planned Won't fix, can't repro, duplicate, stale Jul 19, 2022
@golang golang locked and limited conversation to collaborators Jul 19, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge 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

6 participants