Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

affected/package: go env GOBIN #58851

Closed
pebbe opened this issue Mar 3, 2023 · 4 comments
Closed

affected/package: go env GOBIN #58851

pebbe opened this issue Mar 3, 2023 · 4 comments

Comments

@pebbe
Copy link
Contributor

pebbe commented Mar 3, 2023

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

$ go version
go version go1.20.1 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="/home/peter/.cache/go-build"
GOENV="/home/peter/.config/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/home/peter/go/pkg/mod"
GONOPROXY="github.com/pebbe/dbxml"
GONOSUMDB="github.com/pebbe/dbxml"
GOOS="linux"
GOPATH="/home/peter/go"
GOPRIVATE="github.com/pebbe/dbxml"
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/my/opt/go"
GOSUMDB="sum.golang.org"
GOTMPDIR="/home/peter/tmp"
GOTOOLDIR="/my/opt/go/pkg/tool/linux_amd64"
GOVCS=""
GOVERSION="go1.20.1"
GCCGO="gccgo"
GOAMD64="v1"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/home/peter/go/src/github.com/rug-compling/alpinoviewer/go.mod"
GOWORK=""
CGO_CFLAGS="-O2 -g"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-O2 -g"
CGO_FFLAGS="-O2 -g"
CGO_LDFLAGS="-O2 -g"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -fdebug-prefix-map=/home/peter/tmp/go-build1826612007=/tmp/go-build -gno-record-gcc-switches"

What did you do?

$ go env GOBIN

What did you expect to see?

The name of the directory where go install installs programs.

What did you see instead?

Nothing at all

More...

$ go help environment

The go command and the tools it invokes consult environment variables
for configuration. If an environment variable is unset, the go command
uses a sensible default setting. To see the effective setting of the
variable <NAME>, run 'go env <NAME>'.

[omitted]

General-purpose environment variables:

[omitted]

        GOBIN
                The directory where 'go install' will install a command.

[truncated]

$ go env GOBIN

[no output]

$ env | grep GOBIN

[no output]

$ go env GOENV
/home/peter/.config/go/env

$ cat `go env GOENV`
GOPRIVATE=github.com/pebbe/

@fzipp
Copy link
Contributor

fzipp commented Mar 3, 2023

The empty output means that the GOBIN environment variable is not set.

$ go help environment
[...] If an environment variable is unset, the go command
uses a sensible default setting.

@mvdan
Copy link
Member

mvdan commented Mar 3, 2023

Also see #23439 (comment).

@mvdan mvdan closed this as not planned Won't fix, can't repro, duplicate, stale Mar 3, 2023
@pebbe
Copy link
Contributor Author

pebbe commented Mar 3, 2023

The empty output means that the GOBIN environment variable is not set.

$ go help environment
[...] If an environment variable is unset, the go command
uses a sensible default setting.

Read the next sentence.

The current behaviour is not what the documentation says it should be. So this is clearly a bug, and it should be fixed.

@mvdan
Copy link
Member

mvdan commented Mar 3, 2023

That is exactly what #23439 (comment) describes. That issue remains open as it is not fixed.

@golang golang locked and limited conversation to collaborators Mar 2, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants