Skip to content

cmd/go: warn if implicit GOPATH is equal to GOROOT #24623

@benesch

Description

@benesch

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

$ go version
go version devel +ad0ebc3 Tue Mar 27 19:55:14 2018 +0000 linux/amd64

Does this issue reproduce with the latest release?

Yes.

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

$ go env
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/benesch/.cache/go-build"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/benesch/go"
GORACE=""
GOROOT="/home/benesch/go1.10"
GOTMPDIR=""
GOTOOLDIR="/home/benesch/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-build523055646=/tmp/go-build -gno-record-gcc-switches"

What did you do?

I ran:

$ GOROOT=$HOME/go GOPATH= go env GOPATH
# no output

What did you expect to see?

The warning you normally see when GOROOT is set to the same value as GOPATH, followed by the value of GOPATH:

$ GOROOT=/ GOPATH=/ go env GOPATH
warning: GOPATH set to GOROOT (/) has no effect
/

What did you see instead?

Neither the warning nor the value of GOPATH.

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeNeedsFixThe path to resolution is known, but the work has not been done.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions