Articles

Affichage des articles du février, 2018

Go (Golang) for beginners

Because I might not be the only newbie in the Go world this year, I've decided to document here all the information I gathered.

Install Go Go installation is pretty well documented on the  official Golang page but it can be summarized to: Downloading the binary matching your OS and architecture from the golang download page
wget https://redirector.gvt1.com/edgedl/go/go1.9.2.linux-amd64.tar.gz Extracting the software (/usr/local/go seems to be the recommended location)
tar -C /usr/local -xzf go1.9.2.linux-amd64.tar.gzCreating your Workspace
Go workspace is the place where you put your source code and where the go packages/tools will be downloaded.
mkdir $HOME/go
In this directory, create a src subdirectory where you'll place all your code.
mkdir $HOME/go/srcSetting the environment variables
Setting  GOPATH (export GOPATH=$HOME/go) to point to your workspace.
Then your path PATH (export PATH=$PATH:/usr/local/go/bin:$GOPATH/bin) For a system-wide configuration:
in /etc/profileFor a per use…