Downloading and Installing Go and its tools

Downloading and Installing Go

Satish Manohar Talim
1 min readSep 3, 2015

Visit the Go project’s downloads page and select the binary distribution that matches your operating system and processor architecture.

After downloading a binary release suitable for your system, please follow the installation instructions.

As a recap: The Go binary distributions assume they will be installed in “/usr/local/go” (or “c:\Go” under Windows), but it is possible to install them in a different location. If you do this, you will need to set the “GOROOT” environment variable to that directory when using the Go tools.

For example, if you installed Go to your home directory you should add the following commands to “$HOME/.profile”:

export GOROOT=$HOME/go
export PATH=$PATH:$GOROOT/bin

Note: “GOROOT” must be set only when installing to a custom location.

Under Windows, you may set environment variables through the “Environment Variables” button on the “Advanced” tab of the “System” control panel. Some versions of Windows provide this control panel through the “Advanced System Settings” option inside the “System” control panel.

On Windows, I have also set “GOROOT” to “C:\go”.

Environment Variables: In the same dialog window, edit the “PATH” variable as follows — “C:\go\bin; …rest of PATH”

Test your installation

Check that Go is installed correctly by building a simple program, as follows.

Create a file named “hello.go” in some folder (for now) and put the following program in it:

Then from the folder where you have saved the file “hello.go” run it with the “go” tool:

$ go run hello.go
Hello, world.

If you see the “Hello, world.” message then your Go installation is working.

--

--

Satish Manohar Talim

Senior Technical Evangelist at GoProducts Engineering India LLP, Co-Organizer GopherConIndia. Director JoshSoftware and Maybole Technologies. #golang hobbyist