Getting started with go language on Mac OS X
Node.js is like space shuttle – very sophisticated, very fast but one simple mistake and… it goes down.
So recently i tried The Go Language which is advertised as
Go is an open source programming language that makes it easy to build simple, reliable, and efficient software.
Because google is a creator of this langauge documentation sucks. Plenty of random documents of everwhere, no clean how to documentation.
If you would like to start play with golang – firsting first – download package for Mac OS X. It is located here: download go. Then edit your .profile file and put this 2 lines into it:
nano ~/.profile export GOROOT=/usr/local/go/ export GOPATH=/Users/slawomir.jasinski/go/
Or… if you are using Homebrew you can setup path like so:
GOVERSION=$(brew list go | head -n 1 | cut -d '/' -f 6) export GOROOT=$(brew --prefix)/Cellar/go/$GOVERSION/libexec
Obviously replace slawomir.jasinski with your default username… and make such directory in your folder structure:
mkdir ~/go mkdir ~/go/src
Next step is pretty simple – if you would like to try out some hello world code, just create subfolder in ~/go/src/hello and create your file there.
If you need any libraries, just call
go get url and source will be dowloaded right to correct folder.