Wednesday, May 31, 2017

gopath, goroot and path

I got quite confused about gopath, path and goroot when I started working on a project based on golang. Here is how I setup the environment

In ~/.profile, assume that golang was installed at /usr/local/go, your own project is at /home/ubuntu/hl, add the following

export GOPATH="/home/ubuntu/hl"
export GOROOT="/usr/local/go"
PATH="$GOROOT/bin:$GOPATH/bin:$PATH"

No comments:

Post a Comment