- Download the installer from the page https://golang.org/dl/ and install the package.
Type go
in terminal, to verify the installation.
- Create a Go workspace and set GO PATH
mkdir -p $HOME/go
export GOPATH="$HOME/go"
# Folder contains your golang source codes
mkdir -p $GOPATH/src
# Folder contains the binaries when you install an go based executable
mkdir -p $GOPATH/bin
# Folder contains the Go packages you install
mkdir -p $GOPATH/pkg
# Folder contains the Github Source code for the repos you cloned
mkdir -p $GOPATH/src/github.com
All your imports will be resolved from this GO PATH only
For more info: https://golang.org/cmd/go/#hdr-GOPATH_environment_variable
The folder structure to maintain the local repo is $GOPATH/src/github.com//
For this document, let's assume you're cloning the below repo. https://github.com/keratin/authn-server
mkdir -p $GOPATH/src/github.com/keratin/authn-server
cd $GOPATH/src/github.com/keratin/authn-server
git clone [email protected]:keratin/authn-server.git
To install a go package, you can use go get command.
go get github.com/benbjohnson/ego/cmd/ego
go get github.com/airbrake/gobrake
Note: Depends on the package, it may install a binary under $GOPATH/bin or a package in $GOPATH/pkg
Glide is a package manager for go-lang. Some projects use Glide for maintaining the Go packages. This is similar bundler in rails or maven in Java.
To install Glide
brew install glide
To install the pacakges in glide.yaml
glide install
Nice