Skip to content

affected/package: go install not working #52294

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

Closed
parasit opened this issue Apr 12, 2022 · 2 comments
Closed

affected/package: go install not working #52294

parasit opened this issue Apr 12, 2022 · 2 comments

Comments

@parasit
Copy link

parasit commented Apr 12, 2022

I am trying to set up a working environment on a new Mac (Studio M1 Max), the installation itself was fine, the test code compiles and runs fine, but I get errors when I try to install the basic tools. I tried both "automatically" via VSCode and manually, the effect is the same.

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

$ go version
go version go1.18 darwin/arm64
(installed by homebrew)

Does this issue reproduce with the latest release?

I think I'm using the latest version.

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

MacOs 12.3.1 (21E258) on Apple M1 Max

go env Output
$ go env
GO111MODULE=""
GOARCH="arm64"
GOBIN="/opt/homebrew/bin/go"
GOCACHE="/Users/bart/Library/Caches/go-build"
GOENV="/Users/bart/Library/Application Support/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="arm64"
GOHOSTOS="darwin"
GOINSECURE=""
GOMODCACHE="/Users/bart/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Users/bart/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/opt/homebrew/opt/go/libexec"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/opt/homebrew/opt/go/libexec/pkg/tool/darwin_arm64"
GOVCS=""
GOVERSION="go1.18"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/dev/null"
GOWORK=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -arch arm64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/w9/7vy2my4j3cgbnv5shxyxjpwm0000gn/T/go-build1012162066=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

go install golang.org/x/tools/cmd/godoc@latest

What did you expect to see?

Nothing, installed tool/package.

What did you see instead?

go install golang.org/x/tools/cmd/godoc: mkdir /opt/homebrew/bin/go/: not a directory

When -x is added to command, returns (probably) the correct install log, but finally tries to create a directory that already exists.

lots of "packagefile ..."
...
mkdir -p $WORK/b001/exe/
cd .
/opt/homebrew/opt/go/libexec/pkg/tool/darwin_arm64/link -o $WORK/b001/exe/a.out -importcfg $WORK/b001/importcfg.link -buildmode=exe -buildid=V8q38yVb4G_5JkGEF4fC/OA9lzYVvTTtkH71bQxMG/V6MIBjHJ_aTlwLxGorxt/V8q38yVb4G_5JkGEF4fC -extld=clang /Users/bart/Library/Caches/go-build/7b/7b293eedbbf87742165174a3759d1bd550f1911e93c9d69f98ba6441b16ca03d-d
/opt/homebrew/opt/go/libexec/pkg/tool/darwin_arm64/buildid -w $WORK/b001/exe/a.out # internal
mkdir -p /opt/homebrew/bin/go/
go install golang.org/x/tools/cmd/godoc: mkdir /opt/homebrew/bin/go/: not a directory

At this location is link to current installation:

❯ ls -l /opt/homebrew/bin/go
lrwxr-xr-x  1 bart  admin  24 24 mar 11:21 /opt/homebrew/bin/go -> ../Cellar/go/1.18/bin/go
❯ ls -l /opt/homebrew/bin/go/
lrwxr-xr-x  1 bart  admin  17 15 mar 15:08 /opt/homebrew/bin/go/ -> ../libexec/bin/go

P.S. Same effect is with all "default" tools: go-outline, gotests, gomodifytags, impl, goplay, staticcheck, gopls

@mvdan
Copy link
Member

mvdan commented Apr 12, 2022

Looks like you set your GOBIN path to a file; it needs to point to a directory.

@seankhliao
Copy link
Member

Unlike many projects, the Go project does not use GitHub Issues for general discussion or asking questions. GitHub Issues are used for tracking bugs and proposals only.

For questions please refer to https://github.com/golang/go/wiki/Questions

@golang golang locked and limited conversation to collaborators Apr 12, 2023
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