Description
What version of Go are you using (go version
)?
go version go1.10 linux/amd64
Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (go env
)?
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/yunabe/.cache/go-build"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/yunabe/local/gocode"
GORACE=""
GOROOT="/home/yunabe/go1.10"
GOTMPDIR=""
GOTOOLDIR="/home/yunabe/go1.10/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
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-build331277736=/tmp/go-build -gno-record-gcc-switches"
What did you do?
cd $TMPDIR
go get -d golang.org/x/net/context
go install -buildmode=shared -linkshared -pkgdir `pwd`/tmppkg -linkshared std
go install -x -buildmode=shared -pkgdir `pwd`/tmppkg -linkshared golang.org/x/net/context
What did you expect to see?
The second go install
command compiles context.a and link libgolang.org-x-net-context.so. It takes less than 1 sec to finish.
What did you see instead?
From go1.10, the second go install
run link
command to create libstd.so
though libstd.so
already exists in -pkgdir.
It makes the second go install
command 3-4 times slower (0.77sec in go1.9.4 vs 2.8sec in go1.10)
I debugged the behavior of go tools and it seems like b.useCache
in linkShared
returns false
to libstd.so
target (https://github.com/golang/go/blob/master/src/cmd/go/internal/work/exec.go#L1032).