Skip to content

cmd/get: path@version syntax rejected despite $GOPATH not set #29575

@ahmetb

Description

@ahmetb

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

$ go version
go version go1.11.4 darwin/amd64

Does this issue reproduce with the latest release?

Yes (go1.11.4)

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

go env Output
$ go env
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/ahmetb/Library/Caches/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/ahmetb/go"
GOPROXY=""
GORACE=""
GOROOT="/Users/ahmetb/.homebrew/Cellar/go/1.11.4/libexec"
GOTMPDIR=""
GOTOOLDIR="/Users/ahmetb/.homebrew/Cellar/go/1.11.4/libexec/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
CXX="clang++"
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 -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/76/5g_jbgjn6xg_jkwcm2n_m52r00dl55/T/go-build263455237=/tmp/go-build -gno-record-gcc-switches -fno-common"
  • ⚠️ Also, echo $GOPATH prints nothing in my shell.

What did you do?

Tried to go-get a package that contains a main, without $GOPATH set.

$ go get github.com/rakyll/hey@v0.1.1

What did you expect to see?

  • download package at v0.1.1
  • build
  • install at ~/go/bin/hey

What did you see instead?

$ go get github.com/rakyll/hey@v0.1.1
go: cannot use path@version syntax in GOPATH mode

but I'm not in $GOPATH mode?


Aside: Right now I'm observing:

  1. despite GOPATH not set, go-get cannot be used to download commands anymore if you're specifying path@version syntax.

  2. with go1.11, you can't download commands with go-get to a custom path like you did in env GOPATH=/a/b go get github.com/foo && a/b/foo pre go1.11.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions