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.
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
- Extracting the software (/usr/local/go seems to be the recommended location)
tar -C /usr/local -xzf go1.9.2.linux-amd64.tar.gz
- Creating your Workspace
Go workspace is the place where you put your source code and where the go packages/tools will be downloaded.
In this directory, create a src subdirectory where you'll place all your code.
- Setting 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:
- For a per user configuration:
Editor configurationIf you use vim as I do, you might want to use vim-go or vim-polyglot and read the vim-go tutorial.
But if it's not your case, your solution is probably on the page about the IDEs and editor plugins for Go.
So much more to explore
With this (basic) setup I'm now ready to go further
- Setting up Go in docker
- Do some datascience
- Unleashed goroutines/channels power
But that will be in another post :-)
There are of course many more useful resources to start with.
But I hope the following ones will be as useful to you as they were to me.
- Standard library documentation
- A curated list of awesome Go frameworks/librairies/softwares
- Go tooling for datascience
- Go FAQ
- Go proverbs
- A tour of Go
- Effective Go
- The Go complete developers guide on Udemy
- Learn Go in Y minutes
- Go by example
- More Go tutorials on hackr.io
- Common gotchas and mistakes in Go
- Go Programming (Derek Banas) on youtube
- Your basic Go