Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- GO ENV SETUP TIPS
- In your ~/.bashrc or ~/.bash_profile, where ever you set your environmental vars, set GOROOT, GOPATH and add them to the PATH:
- export GOROOT=/usr/local/go
- export GOPATH=$HOME/go
- export PATH=$PATH:$GOROOT:$GOROOT/bin/:$GOPATH:$GOPATH/bin
- Notice the bin directories are specified. With GOPATH/bin added, the command line will find your compiled go applications.
- $GOPATH is where you put ALL your go projects. The go directory in your home directory is a good choice.
- Put the source code in $GOPATH/src.
- It is recommended to put a specific project in a directory that matches the path of your project/package in your online repo. If the package is github.com/yourname/my_go_package, then it goes in ~/go/src/github.com/yourname/my_go_package.
- If you need to use third party packages you would clone them to match the path of their repo, such as ~/go/src/github.com/someoneelse/their_go_package.
- When you write your package and then go install it, from the package directory, it will be compiled an put in $GOPATH/bin.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement