q TDD in Go
#todo Read Effective Go https://go.dev/doc/effective_go
#Q nil
- what is it exactly. Equivalent of Python’s None
or JS’s null
?
#todo Watch https://www.youtube.com/watch?v=MzTcsI6tn-0
Go was publicly announced in November 2009, and version 1.0 was released in March 2012.
Go has a backward compatibility promise for the major versions.
Why Go
- Compiles to a single native binary. Go includes the Go runtime into every binary, and it makes the distribution of Go programs easier. The drawback is that even for the smallest program Go produces a binary ~2MB.
Install Go
Follow instructions https://go.dev/doc/install.
Don’t forget to sudo
both commands:
Because initially I’ve made a newbie mistake by sudo’ing only the first, but not the second command.
Go code is grouped into packages, and packages are grouped into modules.
Start a new project in Go
Error handling
Functions
Variables
Flow control
CLI
go vet
- a tool that scans for common coding mistakes
Go formatting
Idiomatic Go
- Comprehensibility over conciseness
A great rule of thumb for Go is accept interfaces, return structs.
–Jack Lindamood