Go nooby notes
27. 12. 2019Notes ↓
1st yt hit on ‘learn go’
mpv https://www.youtube.com/watch?v=YS4e4q9oBaU
# 46 min in
- There are $GOROOT and $GOPATH (both empty if go is installed using apt). $GOPATH is a place for resource stuff and can be compound multipath (Like $PATH), idea being separation of external resources vs user code.
Shorter one
mpv https://www.youtube.com/watch?v=SqrbIlUwR0U
go env
-
Source files should use .go extension.
-
workspace is nothing special, but src, bin and pkg (intermediate binary) folders have meaning.
Example structure for an app:
go (workspace)
bin
src
└── github.com
└── brontosaurusrex
└── firstapp
└── Main.go
pkg
GO apps (and resources) ↓
https://github.com/alfredxing/calc (cli calc)
https://raw.githubusercontent.com/rgm3/gomandelbrot/master/main.go (mandelbrot in term)
https://www.freecodecamp.org/news/writing-command-line-applications-in-go-2bc8c0ace79d/