Description
What version of Go are you using (go version
)?
$ go version go version go1.12.6 linux/amd64
Does this issue reproduce with the latest release?
Yes. Tip is slightly different (see later)
What operating system and processor architecture are you using (go env
)?
go env
Output
$ go env GOARCH="amd64" GOBIN="" GOCACHE="/home/jake/.cache/go-build" GOEXE="" GOFLAGS="" GOHOSTARCH="amd64" GOHOSTOS="linux" GOOS="linux" GOPATH="/home/jake/go" GOPROXY="" GORACE="" GOROOT="/usr/lib/go" GOTMPDIR="" GOTOOLDIR="/usr/lib/go/pkg/tool/linux_amd64" GCCGO="gccgo" CC="gcc" CXX="g++" CGO_ENABLED="1" GOMOD="/home/jake/findingbug/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-build614075218=/tmp/go-build -gno-record-gcc-switches"
What did you do?
I want to pin a dependency (to use with gobin
), so I use the tools.go
pattern.
module findingbug
go 1.12
require github.com/maxbrunsfeld/counterfeiter/v6 v6.2.0
// +build tools
package tools
import (
_ "github.com/maxbrunsfeld/counterfeiter/v6"
)
I perform operations with this in place, like go mod tidy
, or a go get
to do an update; something that modifies go.mod
.
What did you expect to see?
Running go mod tidy
with this setup prints nothing interesting, maybe a download once to get v6.2.0
. If I were at v6.1.0
, a go get
can update it and again print maybe a finding/downloading line or two.
What did you see instead?
Any operation that modifies go.mod
(I think that's the condition) constantly prints messages like these:
$ go mod tidy
go: finding github.com/maxbrunsfeld/counterfeiter/v6/fixtures/fixturesfakes latest
go: finding github.com/maxbrunsfeld/counterfeiter/v6/fixtures latest
go: finding github.com/maxbrunsfeld/counterfeiter latest
go: downloading github.com/maxbrunsfeld/counterfeiter v0.0.0-20190614042641-5e26f8d4cfe9
If I go into ~/go/pkg/mod/github.com/maxbrunsfeld/counterfeiter/[email protected]
and try to see if there's some bad import path, I find nothing. Every import path uses /v6
at the end, and the only usage without it is a go get
example for use without modules.
Using gotip
, less is printed, but it's still shown for every operation:
$ gotip version
go version devel +44c9354 Fri Jun 21 05:21:30 2019 +0000 linux/amd64
$ gotip mod tidy
go: finding github.com/maxbrunsfeld/counterfeiter latest
The only way I've found for this specific case to make at least the "downloading" go away is to do:
replace github.com/maxbrunsfeld/counterfeiter => github.com/maxbrunsfeld/counterfeiter/v6 v6.2.0
But the finding
lines never go away (even on tip). Note that none of this prevents the binary from being built; go run
and gobin
all have no trouble building and running what I want (with or without that replace).
It's not clear to me what the issue is if both counterfeiter
and my own code all use the /v6
import path consistently, but it's frustrating for many go
invocations to print a bunch of stuff to stderr.