Check installation
go version
Environment variables
GOROOT
Folder where go was installated. It must only be set when installing to a custom location.
GOPATH
Place to get, build and install packages outside the standard Go Tree.
# golang
export GOPATH=/home/msanchez/go/packages
export GOROOT=/home/msanchez/Programs/go
export PATH=$PATH:$GOROOT/bin:$GOPATH/bin
Multiple workspaces
For a custom installation, it’s possible to give more than one value to GOPATH
.
export GOPATH="/home/msanchez/go/packages/bin:/home/msanchez/Documents/Personal/Github/language_testing/golang"
The first value is used as default to install packages. The second and next ones may be used as standalone workspaces. It’s important for the root of the workspace to be /src
, otherwise it will complain and not compile into /bin
.
IDE preparation
I use Sublime, to get it ready:
ctrl + shift + p
install package
Install the packages:
GoOracle
All Autocomplete
(missing steps)
To compile / build / run
ctrl + shift + P
go install
go run