-
Notifications
You must be signed in to change notification settings - Fork 18k
release: MSI installer should put %USERPROFILE%\go\bin to PATH #18690
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
Comments
I am all confused about your description. Alex |
I think Dogan talks about the newly introduced default
GOPATH=%USERPROFILE%/go feature and want the installer to add the default
GOPATH/bin to %PATH%.
|
I see now. But Go installer does not change users GOPATH at this moment. I am not sure I would be happy, if Go installer changed my current GOPATH to %USERPROFILE%\go\bin. Alex |
On Wed, Jan 18, 2017 at 3:57 AM, Alex Brainman ***@***.***> wrote:
want the installer to add the default
GOPATH/bin to %PATH%.
I see now. But Go installer does not change users GOPATH at this moment. I
am not sure I would be happy, if Go installer changed my current GOPATH to
%USERPROFILE%\go\bin.
It won't change GOPATH. cmd/go will apply a default value if %GOPATH% is
unset.
Please see https://tip.golang.org/doc/go1.8#gopath.
|
It is not going to set the GOPATH. It is going to add the default GOPATH's bin folder to the PATH.
It might be a good to add this folder to PATH for the convenience of the user. Then, the majority of the users don't have to deal with environment variables at all unless they want to override anything. If they want to set a custom GOPATH, they are probably good enough to fix the PATH. |
I can see now what you are proposing. Do you propose Go install program removes it from the PATH when user clicks "Uninstall" button? Imaging that user might be "upgrading" their installation by doing "uninstall" followed by "install" of new version. If you decide to leave it as is during "uninstall", you would end up with multiple of %USERPROFILE%\go\bin in user's PATH. I am also concerned that this
might install some random program on my computer. And I might not even notice that I am running it. Alex |
On Thu, Jan 19, 2017 at 1:15 AM, Alex Brainman ***@***.***> wrote:
It is going to add the default GOPATH's bin folder to the PATH.
I can see now what you are proposing.
Do you propose Go install program removes it from the PATH when user
clicks "Uninstall" button? Imaging that user might be "upgrading" their
installation by doing "uninstall" followed by "install" of new version. If
you decide to leave it as is during "uninstall", you would end up with
multiple of %USERPROFILE%\go\bin in user's PATH.
I am also concerned that this
go get github.com/hacker/ping
might install some random program on my computer. And I might not even
notice that I am running it.
Good point. I think we still need the user to explicitly add their
GOPATH/bin to %PATH%.
|
This problem exists all times if the bin is in PATH. What's our broader best practice? Asking users to add GOPATH\bin to PATH every time they open a command prompt? I can only speak about Unix, but other build tools and package managers often support only installing to (/usr/bin, /usr/local/bin and variants) which requires sudo but Go fails with this concern as it recommends adding GOPATH/bin to PATH as the initial step after the installation. |
On Thu, Jan 19, 2017 at 1:09 PM, Jaana B. Dogan ***@***.***> wrote:
might install some random program on my computer. And I might not even
notice that I am running it.
This problem exists all times if the bin is in PATH. What's our broader
best practice? Asking users to add GOPATH\bin to PATH every time they open
a command prompt?
Other build tools and package managers often support only installing to
(/usr/bin, /usr/local/bin and variants) which requires sudo but Go fails
with this concern as it recommends adding GOPATH/bin to PATH as the initial
step after the installation.
I don't add $GOPATH/bin to my $PATH. Instead I symlink useful programs from
$GOPATH/bin to $HOME/bin. It's done precisely to avoid having arbitrary
programs in my $PATH (and I don't include . in my $PATH either.)
(Actually, I don't install most of my programs because that's prone to
version mismatch problems. I rebuild the program before running them. And I
don't even use $GOPATH/pkg because I switch Go versions often and older
versions of Go tool don't handle objects built with incompatible compiler
versions well.)
|
I do not know.
I am not average Go Windows user - I use Linux to develop. But on Windows I rarely change my "global" environment. When I develop with Go, I have a.bat file (or many) stored on my desktop:
that I double click. That starts command shell with everything setup to my liking. This allows me to quickly change everything I want (copy batch file and edit). I can also run different versions of Go (or everything else) at the same time. Mind you, I only use command prompt. But, I guess, you could start your IDE instead of cmd, if you like. Alex |
Due to the security concerns, we are not fixing this. |
With the establishment of the default GOPATH, the Windows installer should put the default bin folder (%USERPROFILE%\go\bin) to the PATH for the convince of the user.
Expert users who wants to set a custom GOPATH can manually edit the PATH to include the custom GOPATH bin folder.
The text was updated successfully, but these errors were encountered: