-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Description
What version of Go are you using (go version
)?
go version go1.11 linux/amd64
Does this issue reproduce with the latest release?
Yes, if latest release is 1.11
What operating system and processor architecture are you using (go env
)?
The following was created in the docker container golang:1.11
with GO111MODULE=on
:
GOARCH="amd64"
GOBIN=""
GOCACHE="/root/.cache/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/go"
GOPROXY=""
GORACE=""
GOROOT="/usr/local/go"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/go/src/my_private_project/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-build292379904=/tmp/go-build -gno-record-gcc-switches"
What did you do?
I am using the new module functionality to handle my project dependencies. One of my dependencies has an import path that is a gopkg.in
redirect URL. My corporate network does not allow gopkg.in
for security reasons, so in my go.mod
file I use a replace statements:
replace (
gopkg.in/yaml.v2 v2.0.0 => github.com/go-yaml/yaml v0.0.0-20180328195020-5420a8b6744d
gopkg.in/yaml.v2 v2.2.1 => github.com/go-yaml/yaml v0.0.0-20180328195020-5420a8b6744d
// ... etc
)
require (
gopkg.in/yaml.v2 v2.2.1
// ... etc
)
My dependency graph only lists the two versions of go-yaml that I included in my replacement statements:
$ go mod graph | grep gopkg.in/yaml
my_private_project gopkg.in/[email protected]
[email protected] gopkg.in/[email protected]
[email protected] gopkg.in/[email protected]
github.com/spf13/[email protected] gopkg.in/[email protected]
github.com/hashicorp/[email protected] gopkg.in/[email protected]
gopkg.in/[email protected] gopkg.in/[email protected]
[email protected] gopkg.in/[email protected]
[email protected] gopkg.in/[email protected]
gopkg.in/[email protected] gopkg.in/[email protected]_private_project
When performing a module based install, the following appears in the output:
$ GO111MODULE=on go build
Fetching https://gopkg.in/yaml.v2?go-get=1
https fetch failed: Get https://gopkg.in/yaml.v2?go-get=1: dial tcp 35.196.143.184:443: i/o timeout
The other packages then compile and the executable successfully builds.
What did you expect to see?
No references to any attempt of downloading the gopkg.in/yaml project. Instead, the direct GitHub link provided in the replacement statements should be fetched instead.
What did you see instead?
The go command attempts to reach the gopkg.in/yaml URL each time a build is attempted. It causes a longer than needed build time since the fetch times out. The build succeeds, but it isn't clear why since the fetch failed.