Installer sets PATH environment variable incorrectly

Hi all

This is my first post on here. I am not exactly sure where to post this but here goes …

I installed Go on Windows 7 Pro 64 using the installer: go1.10.3.windows-amd64.msi

The installer created 2 environment variables:
User level variable: GOPATH
System level variable: GOROOT

The GOPATH environment variable (according to the “Getting Started” documentation) is the path to your workspace. I changed this because I have my source in another location.

The GOROOT environment variable is set to the installation directory for Go; in my case this is “c:\Go”

The installer added the path to the Go binary directory to the PATH environment variable as this:

%GOPATH%\bin

This is incorrect … it needs to be:

%GOROOT%\bin

Have fun folks!

No %GOPATH%\bin is correct. When you install packages you have written or used go get to retrieve from a repo, they will be installed in GOPATH\bin and GOPATH\src, the environment needs to know where to find these. It always checks GOROOT\bin first without the need of it being specified.

GOPATH: https://github.com/golang/go/wiki/GOPATH
GOROOT: https://dave.cheney.net/2013/06/14/you-dont-need-to-set-goroot-really

1 Like

Thanks for setting me straight.

You are correct!

What the install instructions are missing is the need for a complete logout of Windows - otherwise the system level GOROOT variable will not be recognized.

:thinking:

Usually it should be enough to close and reopen the terminal, but nevertheless, one can always do a temporary set

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.