Skip to content

Compiler fetching offline modules during build causing slow compiles #29856

Closed
@tvarwig

Description

@tvarwig

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

$ go version
go version go1.11 darwin/amd64

Does this issue reproduce with the latest release?

Yes latest stable release

What operating system and processor architecture are you using (go env)?

go env Output
$ go env
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/tvarwig/Library/Caches/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/tvarwig/go"
GOPROXY=""
GORACE=""
GOROOT="/usr/local/go"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD=""
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/w4/xxfhfbg12j12lf5h78g0cg3r0000gn/T/go-build270144360=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

After enabling modules support go run and go build take minuets to compile. I have ran the go mod vendor to create the vendor folder. Without modules enabled compile time is less than a second. They do successfully compile.

After running verbose the compiler is trying to fetch offline modules with the following message https fetch failed: Get https://mygit.net/myapp/pb/users?go-get=1: dial tcp gitipaddress:443: i/o timeout

In the go.mod I have the replace option with those modules

module mygit.net/myapp/api/gui

require (
	mygit.net/myapp/pb/users v0.0.0
	github.com/dgrijalva/jwt-go v3.2.0+incompatible
	github.com/go-redis/redis v6.15.1+incompatible
	github.com/gogo/protobuf v1.2.0
	github.com/google/uuid v1.1.0
	github.com/iancoleman/strcase v0.0.0-20180726023541-3605ed457bf7 // indirect
	github.com/jpillora/go-tld v0.0.0-20180808214523-4bfc8d9a90b5
	github.com/labstack/echo v3.3.5+incompatible
	github.com/labstack/gommon v0.2.8 // indirect
	github.com/mattn/go-colorable v0.0.9 // indirect
	github.com/mattn/go-isatty v0.0.4 // indirect
	github.com/spf13/viper v1.3.1
	github.com/valyala/bytebufferpool v1.0.0 // indirect
	github.com/valyala/fasttemplate v0.0.0-20170224212429-dcecefd839c4 // indirect
	golang.org/x/crypto v0.0.0-20190103213133-ff983b9c42bc
	google.golang.org/grpc v1.18.0
)

replace mygit.net/myapp/pb/users => ../../pb/users

What did you expect to see?

faster compiling times before modules. From what I have studies the replace should look locally and not fetch.

What did you see instead?

slow compile times.

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeWaitingForInfoIssue is not actionable because of missing required information, which needs to be provided.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions