Javatpoint Logo
Javatpoint Logo

Go Installation

You can install Go programming on different operating systems like Windows, Linux, Mac etc. This is a link of binary distribution of the Go programming for FreeBSD (release 8-STABLE and above), Linux, Mac OS X (10.8 and above), and Windows operating systems for the 32-bit (386) and 64-bit (amd64) architectures.

If you do not found configuration of your combination, try installing from source or installing gccgo instead of gc.

In Linux

  • We should choose the required archive file for installation. For Example, if we are installing Go version 1.6.1 for 64-bit x86 on Linux, the archive would be go1.2.1.linux-amd64.tar.gz.
  • Now download the archive and extract it in /usr/local directory. We need to create a Go tree in /usr/local/go directory through following command:
  • To set path, add /usr/local/go/bin to the PATH environment variable. We can do this by adding following line to the command line:

In Windows

  • Choose the required archive file for Windows installation.
  • Download zip file and extract it into the directory (Like c:\Go).
  • If you have choosed a different directory other than c:\Go, you must set the GOROOT environment variable to your chosen path.
  • Add the bin subdirectory of your Go root (for example, c:\Go\bin) to your PATH environment variable.

In Mac OS X

  • Choose the required archive file for Mac installation.
  • Open the downloaded package file, and follow the prompts to install the Go tools. The package installs the Go distribution to /usr/local/go.
  • The package should locate the /usr/local/go/bin directory to your PATH environment variable. You may need to restart the opened terminal sessions to make the change.

Go Installation in Ubuntu

Step 1: Run the command sudo apt-get install golang

Go Installation 1
Go Installation 2

Step 2: Press 'y' when you asked

Go Installation 3
Go Installation 4

Now, Go installation is done, You can check the version by the command: go version.

Go Installation 5
Next TopicGo Hello World




Please Share

facebook twitter google plus pinterest

Learn Latest Tutorials


Preparation


B.Tech / MCA