Skip to content

cmd/go: 'go env' should set GOBIN #68102

Closed as not planned
Closed as not planned
@dolmen

Description

@dolmen

go env GOBIN would be helpful to tools beyond the Go toolchain to determine where go install will install a binary.

However, up to go 1.22.4, the go install directory is not explicitely exposed like GOPATH is. Instead GOBIN is exposed with an empty value.

Go version

go version go1.22.4 darwin/arm64

Output of go env in your module/workspace:

GOBIN=''
GOPATH='/Users/gopher/go'

What did you do?

$ go help environment | sed -n '/GOBIN/{N;p;}'
	GOBIN
		The directory where 'go install' will install a command.
$ env | grep GOBIN
$ cat "$(go env GOENV)"
$ go env GOBIN

$ go env | grep GOBIN
GOBIN=''

What did you see happen?

See above

What did you expect to see?

$ go env GOPATH
/Users/gopher/go
$ env | grep GOBIN
$ cat "$(go env GOENV)"
$ go env GOBIN
/Users/gopher/go/bin
$ go env | grep GOBIN
GOBIN='/Users/gopher/go/bin'

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