Go
Installation
brew install go
Analysis tools
- Analysis tools are installed at
$GOPATH/bin
where$GOPATH=~/go
-
The vscode extension
golang.go
installs all the required tools automatically on the go path -
staticcheck
gopkgs
go-outline
dlv
# Language Server from Google
go get -v "golang.org/x/tools/gopls"
# Linter
go get -v "honnef.co/go/tools/cmd/staticcheck"
# Go debugger (Delve)
go get -v "github.com/go-delve/delve/cmd/dlv"
go get -v "github.com/uudashr/gopkgs/v2/cmd/gopkgs"
go get -v "github.com/ramya-rao-a/go-outline"
Packages
- Standard library packages: https://pkg.go.dev/std
- 3rd party packages: https://pkg.go.dev/
Running code
- Only a "main package" (with a "main function") can is self executable
# the filename doesn't matter as long as it is a "main package" with a "main function"
go run foo.go