Open sryze opened 5 months ago
I think this comes from CL 104115
CC @golang/release.
The Windows installer currently always takes responsibility for setting the GOPATH
environment variable (to %USERPROFILE%\go
) and adding %GOPATH%/bin
to PATH
. If a user wishes to use a different location, they need to override both of those. (Note that this is different from the macOS installer, which currently doesn't take responsibility for GOPATH, leaving it entirely to the user. Though different in behavior to each other, both installers have been consistent in their according behavior for a while.)
It seems this is a feature request to make it possible to opt out of this behavior in the Windows installer, so if a user wishes to pick a different GOPATH
location, they can do it in a better way than forcibly overriding both GOPATH
and PATH
environment variables after the installer completed.
While you're at it, perhaps adding the Go installation directory (C:\Program Files\Go
) to PATH should also be made a checkbox (checked by default)? So it could look something like this:
[V] Add Go to PATH [V] Add GOPATH\bin to PATH
or they could be merged into one:
[V] Add Go and GOPATH\bin to PATH
Below are some examples from other popular packages:
Node:
Java:
Python:
Go version
go version go1.22.1 windows/amd64
Output of
go env
in your module/workspace:What did you do?
What did you see happen?
Despite that I have
GOPATH=E:\Tools\Go\gopath
andE:\Tools\Go\gopath\bin
is present in myPATH
, the installer still appends the default value%USERPROFILE%\go\bin
to my PATH.What did you expect to see?
Expected to not have
PATH
modified by the installer.At the very least, it should ask if the user would like to add
%GOPATH%\bin
to PATH during installation, similar to how other software does it, e.g. OpenJDK (Eclipse Temurin) does that.