A πbatteries-included Golang project template derived from bootstrapping many Golang projects
pre-commit
: https://pre-commit.com/
A framework for managing and maintaining multi-language pre-commit hooks.
golangci-lint
: https://golangci-lint.run/
Fast linters Runner for Go.
log/slog
:
Stdlib structured, pluggable logging >= Go 1.21.0.
koanf
: https://github.com/knadh/koanf
Simple, lightweight, extensible, configuration management library for Go.
testify
: https://github.com/stretchr/testify
A toolkit with common assertions and mocks that plays nicely with the standard library.
https://github.com/golang-standards/project-layout
π΄ from https://github.com/cloudflare/cloudflare-go/blob/master/.golintci.yaml
π΄ from https://github.com/github/gitignore/blob/main/Go.gitignore
go run main.go
.env
is excluded from git as environment variables can contain credentials and secrets.
vim .env
LOG_LEVEL=debug
LOG_FORMAT=json
or via CLI:
export LOG_FORMAT=json && export LOG_LEVEL=debug && go run main.go
Test for coverage and race conditions
go test -race -covermode=atomic . /...
pre-commit run --all-files --show-diff-on-failure
make help
make vuln
π
With Vulnerability Management for Go scan our proj against the Go vulnerability database.
This is a template project for starting your next Golang proj:
example fmt.Println("Hello, world")
will throw an error running golangci-lint run ./...
or pre-commit
note: env variable values are case-insensitive ex. LOG_LEVEL=
both INFO
and info
are valid.
Name | Description | Default |
---|---|---|
CONF_PATH |
dotenv-style conf file | ./.env |
LOG_LEVEL |
logging levels: trace ,debug ,info ,warn |
INFO |
LOG_FORMAT |
logging format: json or defaults to plaintext |
TEXT |
Branch for web-based Golang apps with Gin π₯
https://github.com/gin-gonic/gin
Branch for cli-based Golang apps with urfave/cli