golang / go

The Go programming language
https://go.dev
BSD 3-Clause "New" or "Revised" License
124.11k stars 17.68k forks source link

x/build/internal/installer/darwinpkg: macOS PKG installer shows misleading error when installing for the wrong architecture #58235

Open rothskeller opened 1 year ago

rothskeller commented 1 year ago

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

$ go version
go version go1.20 darwin/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="/Users/stever/Library/Caches/go-build"
GOENV="/Users/stever/Library/Application Support/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOINSECURE=""
GOMODCACHE="/Users/stever/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Users/stever/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64"
GOVCS=""
GOVERSION="go1.20"
GCCGO="gccgo"
GOAMD64="v1"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/dev/null"
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 -arch x86_64 -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/3y/936sl4d50dd_38rvrs041qn80000gn/T/go-build2823487662=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

Accidentally attempted to install the go1.20 installer for ARM64 rather than x86.64.

What did you expect to see?

An error message that I have the wrong installer.

What did you see instead?

An error message saying "Go can't be installed on this computer." This is an inaccurate message; Go can be installed on this computer — it just needs a different installer.

mknyszek commented 1 year ago

CC @golang/release

dmitshur commented 1 year ago

Thanks for reporting.

We're using Xcode tooling to create a fairly standard macOS installer (see here). This has upsides like providing a familiar, native look and feel, and downsides in that we can only make customizations that are supported.

The "Go cannot be installed on this computer" text isn't coming from our installer directly, the installer automatically reports it based on which architecture(s) are configured to be supported by each installer. This is needed so that e.g. Rosetta isn't incorrectly required for arm64 installer (issue #43422). So the message is accurate, but doesn't take into account that Go provides macOS installers for both amd64 and arm64 architectures.

One idea is we may be able to adjust the text so that something like "Go (for darwin/arm64)" instead of just "Go" is shown. Maybe there's more customization that can be useful (e.g., there's already a custom check to report old macOS version). Otherwise we may need to rely the https://go.dev/dl/ website text to minimize the chance of users selecting a suboptimal installer for their needs.