Go 101
This sets more realistic expectations about Golang.
About Go 101
Main selling point of Golang:
- Fairly flexible for a static language.
- Unique combination of memory saving, fast program warming-up and fast code execution speed.
- Built-in concurrent programming support.
- Great code readability.
- Great cross-platform support.
- Vibrant group.
I didn’t quite understand how this particular book is useful. He says a few things about it, but I did not understand it. I am sold on the style. So let’s see how this works out for me.
An Introduction of Go
There are numerous features of Go listed here.
Go programmers are often called gophers.1
The most popular Go compiler is
gc
, written in Go. There is a second compilergccgo
, but it is no longer a priority for the Go design team.Go Toolchain is a set of tools for Go development maintained by Go team.
gc
is a part of this collection.The version of Go is consistent with the version of Go Toolchain. There were/are two major versions released each year.
Go 1.8 made massive improvements in the concurrent garbage collection implementation. Lags caused by garbage collection were massively reduced.
Go is popular for development in
- networks
- system tools
- databases
- block chain
There are signs of usage in
- game development
- big data
- AI
Drawbacks
- Go doesn’t support arbitrary immutable values. Right now many values which are not supposed to be modified in standard packages are declared as variables. This is a security concern.
- Go also doesn’t support generics for custom types and functions. (I don’t understand this one.)
The Go Toolchain
- In order to easily call the
go
command add thebin
sub-folder to thePATH
environment variable. - Since Go 1.16, project dependencies are managed using modules.
GOPATH
is an environment variable. The default Go workflow happens entirely inside theGOPATH
. By default, it’s thego
folder under the home directory of the current user. It has three folders in there.bin
: the place where Go program binaries end up.pkg
: stores the cached versions of Go modules for local Go projects.src
: the place where you should store your projects.
- The simplest Go program:
package main func main() { }
- The first line
package main
specifies the package name.
- The first line
Apparently there is an old cartoon called Go Go Gopher. That’s probably where you get the Go mascot. Read about its history on the Golang blog ↩︎