go-template icon indicating copy to clipboard operation
go-template copied to clipboard

Template for Go projects

go-template

Goreport status Test status

Toolbox for new Go projects!

  • Makefile with lint, test, build, fmt and more
  • Linting with gofmt, gofumpt, go vet, staticcheck and golangci-lint
  • Logging setup using the Zap logger (with debug and json logging options)
  • GitHub Workflows for linting and testing, as well as releasing and publishing Docker images
  • Entry files for CLI and HTTP server
  • Webserver with graceful shutdown, implementing livez, readyz and draining API handlers
  • See also:
    • Public project setup: https://github.com/flashbots/flashbots-repository-template
    • Repository for common Go utilities: https://github.com/flashbots/go-utils

Pick and choose whatever is useful to you! Don't feel the need to use everything, or even to follow this structure.


Getting started

Build CLI

make build-cli

Build HTTP server

make build-httpserver

Install dev dependencies

go install mvdan.cc/gofumpt@latest
go install honnef.co/go/tools/cmd/staticcheck@latest
go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest
go install github.com/daixiang0/gci@latest

Lint, test, format

make lint
make test
make fmt