Skip to content

Instantly share code, notes, and snippets.

@canthis
Last active April 17, 2019 11:26
Show Gist options
  • Save canthis/4a7a11792e5895e182059f2327d120b2 to your computer and use it in GitHub Desktop.
Save canthis/4a7a11792e5895e182059f2327d120b2 to your computer and use it in GitHub Desktop.
Add GoLang to PATH on Linux

Add required paths to the PATH environment variable by inserting the lines below in your /etc/profile file for a system-wide installation or $HOME/.profile or $HOME./bash_profile for user specific installation:

Using your preferred editor, open the appropriate user profile file as per your distribution and add the lines below, save the file and exit:

export GOPATH="$HOME/go"
export GOBIN="$GOPATH/bin"
export PATH="$PATH:/usr/local/go/bin"
export PATH="$PATH:$GOBIN"

The final step under this section is to effect the changes made to the user profile in the current bash session like so:

$ source ~/.profile
OR
$ source ~/.bash_profile
OR
$ source ~/.zshrc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment