This repository is a collection of Go practice problems, or other assorted findings.
Requires golang, bazel, and golangci-lint.
Run make build
to build all of the things, make test
to test all of the
things, and make lint
to lint all of the things. If you get a bazel build
error, try running make fix-build
which will run formatting and build file
updates.
This repository uses Bazel to compile and run tests locally. Bazel can be downloaded, installed, and managed on your local machine using Bazelisk.
Bazel BUILD
files are automatically generated and managed using
Gazelle.
Linting is handled using golangci-lint and is
configured using the .golangci.yml
file.
The CI/CD pipeline is run via GitHub actions and does not use Bazel, rather the standard Golang toolchain to build, vet, lint, and test. Test coverage is uploaded to Codecov for reports on coverage deltas.
See:
See https://go.dev/doc/modules/managing-dependencies for documentation on Go modules dependency management.
TL;DR — if you import a new third party package, for example a line like
import "google.golang.org/grpc/status"
, then run go get .
to automatically
fetch the dependency and update the go.mod
and go.sum
files.
My local setup does not have the $GOPATH
environment variable set (check with
echo ${GOPATH?}
). As a result, GOPATH
falls back to ${HOME}/go
, which you
can confirm by running go env GOPATH
. See
here for more
details.