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

Open
dlip opened this Issue Mar 25, 2019 · 6 comments

Comments

Projects
None yet
4 participants
@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

This comment has been minimized.

Copy link
Member

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?)

@mhr3

This comment has been minimized.

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

This comment has been minimized.

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 this to the Go1.13 milestone Apr 13, 2019

@bcmills

This comment has been minimized.

Copy link
Member

bcmills commented Apr 13, 2019

See also #27841 (comment).

@gopherbot

This comment has been minimized.

Copy link

gopherbot commented Apr 16, 2019

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

@dlip

This comment has been minimized.

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.