Skip to content

cmd/go: GOPATH mode rejects directory arguments outside of GOPATH/src that contain '@' characters #45944

@metux

Description

@metux

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

go version go1.14 linux/386

Does this issue reproduce with the latest release?

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

go env Output
GO111MODULE=""
GOARCH="386"
GOBIN=""
GOCACHE="/home/nekrad/.cache/go-build"
GOENV="/home/nekrad/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="386"
GOHOSTOS="linux"
GOINSECURE=""
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/usr/lib/go-1.13"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/lib/go-1.14"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/lib/go-1.14/pkg/tool/linux_386"
GCCGO="gccgo"
GO386="387"
AR="ar"
CC="gcc"
CXX="g++"
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 -m32 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build963122998=/tmp/go-build -gno-record-gcc-switches"

What did you do?

Building w/ 'go build' and setting GOPATH to a directory that happens to have @ in its name.

What did you expect to see?

Build w/o errors

What did you see instead?

/usr/lib/go-1.14/bin/go build -ldflags "-s -w" -o /home/nekrad/src/deb-pkg/pkg/moby-engine@master.git/tmp/build/dockerd-linux-i386 /home/nekrad/src/deb-pkg/pkg/moby-engine@master.git/cmd/dockerd
can't load package: package /home/nekrad/src/deb-pkg/pkg/moby-engine@master.git/cmd/dockerd: cannot use path@version syntax in GOPATH mode

It tries to do some magic interpretation on an opaque directory name, which it should NOT do.
The directory names are externally given by some infrastructure.
'go build' just should take it as it is (and cope w/ all characters that are allowed for file names on Linux/Unix platforms).

Metadata

Metadata

Assignees

No one assigned

    Labels

    GoCommandcmd/goNeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions