go version
to see the installed version of Go.GOPATH
environment variable specifies the location of your workspace. It defaults to a directory named go
inside your home directory ($HOME/go
)..bash_profile
, .bashrc
or .zshrc
.GOPATH/bin
directory to your PATH
environment variable so you can run Go programs anywhere.source .bash_profile
your current session or simply open new tab within iTerm.$GOPATH/src/hello/main.go
and add some code, for example:$GOPATH/bin
, then run:$GOPATH/bin
added to your $PATH
, you can run your program from anywhere:go get
command:mux
into this directory $GOPATH/src/github.com/gorilla/mux
.godoc
command you can generate documentation from your code and read documentation from other packages.godoc
. More information in the Godoc documentation.go get golang.org/x/tour
and running it anywhere by tour
(given that you added GOPATH/bin
to your PATH
).