Skip to content

go/build: tests use a non-hermetic "go" binary #39198

@bcmills

Description

@bcmills

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

$ go version
go version devel +567fe4650b Thu May 21 13:43:48 2020 -0400 linux/amd64

Does this issue reproduce with the latest release?

Yes.

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

go env Output
$ go env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/usr/local/google/home/bcmills/.cache/go-build"
GOENV="/usr/local/google/home/bcmills/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/usr/local/google/home/bcmills/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/usr/local/google/home/bcmills"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/google/home/bcmills/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/google/home/bcmills/go/pkg/tool/linux_amd64"
GCCGO="/usr/local/google/home/bcmills/bin/gccgo"
GOAMD64="alignedjumps"
AR="ar"
CC="gcc"
CXX="c++"
CGO_ENABLED="1"
GOMOD="/usr/local/google/home/bcmills/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=/tmp/go-build456911771=/tmp/go-build -gno-record-gcc-switches"

What did you do?

~/go/src$ ls ~/minbin
ar  as  cat  clang  diff  echo  env  gcc  ld  pwd  uname  whoami

~/go/src$ PATH=~/minbin ../bin/go test go/build
--- FAIL: TestImportDirNotExist (0.00s)
    --- FAIL: TestImportDirNotExist/GO111MODULE=on (0.00s)
        build_test.go:356: Import(full, 0) got error: "go/build: go list go/build/doesnotexist: exec: \"go\": executable file not found in $PATH\n\n", want "cannot find package" or "is not in GOROOT" error
        build_test.go:356: Import(full, FindOnly) got error: "go/build: go list go/build/doesnotexist: exec: \"go\": executable file not found in $PATH\n\n", want "cannot find package" or "is not in GOROOT" error
--- FAIL: TestImportPackageOutsideModule (0.00s)
    build_test.go:480: error when importing package when no go.mod is present: got "go/build: go list example.com/p: exec: \"go\": executable file not found in $PATH\n\n"; want "cannot find module providing package"
FAIL
FAIL    go/build        0.107s
FAIL

What did you expect to see?

Tests run using the go command from the same GOROOT used to build the go/build test.

What did you see instead?

A test failure due to the go command not being present in PATH.

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeNeedsFixThe path to resolution is known, but the work has not been done.TestingAn issue that has been verified to require only test changes, not just a test failure.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions