go: cmd/internal/moddeps: TestAllDependencies fails when GOROOT involves symlinks

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

$ go version
go version devel go1.17-6c1c055d1e Wed May 19 15:20:08 2021 +0000 linux/amd64

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

go env Output
$ go env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/a/.cache/go-build"
GOENV="/home/a/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/home/a/n/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/a/n/go/"
GOPRIVATE=""
GOPROXY="direct"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR="/dev/shm/"
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GOVCS=""
GOVERSION="devel go1.17-6c1c055d1e Wed May 19 15:20:08 2021 +0000"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/usr/local/go/src/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=/dev/shm/go-build777046897=/tmp/go-build -gno-record-gcc-switches"

What did you do?

./all.bash

What did you expect to see?

PASS

What did you see instead?

--- FAIL: TestAllDependencies (0.00s)
    moddeps_test.go:49: findGorootModules didn't find the well-known module "std"
--- FAIL: TestDependencyVersionsConsistent (0.00s)
    moddeps_test.go:321: findGorootModules didn't find the well-known module "std"
FAIL
FAIL	cmd/internal/moddeps	0.008s

It seems that this was introduced by https://go-review.googlesource.com/c/go/+/320991 6c1c055d1ea417d050503efe92c1eead0da68cef

cc @dmitshur

About this issue

  • Original URL
  • State: open
  • Created 3 years ago
  • Comments: 16 (15 by maintainers)

Most upvoted comments

PS. I actually took a look at fixing this a few days ago. It turns out that there are many places in that set of tests that assumes runtime.GOROOT() is not a symlink.

No, the original report is against a commit that happened after dade83a588feace6af9882500f2282c8a83f54d0

I have a symlink called /usr/local/go that points to the directory /usr/local/go-tip which is a normal git checkout of the go repository. The env variable PATH contains /usr/local/go/bin. The output of go env GOROOT is /usr/local/go the GOROOT environment variable is not set.

Both dade83a588feace6af9882500f2282c8a83f54d0 and its parent fef5a153961fc314499f3c3208e001593f95a8e6 pass all the tests.

The output of go env GOROOT is actually a symlink on my system. This is the only thing I can think of that could affect this.