Setting GOPATH

Zaki Manian edited this page Jun 24, 2018 · 4 revisions

This page helps you set your GOPATH environment variable after installing go.


The GOPATH environment variable is a directory where all Go projects live.

First, make your GOPATH directory

> mkdir ~/go

Then, set environment variables in your shell startup script. On OS X, this is ~/.bash_profile. For different operating systems or shells, the path may be different. For Ubuntu, it may be ~/.profile or ~/.bashrc.

echo export GOPATH=\"\$HOME/go\" >> ~/.bash_profile
echo export PATH=\"\$PATH:\$GOPATH/bin\" >> ~/.bash_profile
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.