Skip to content
/ go-boilerplate Public template

Go boilerplate code. Features Dockerfile with cache, logging and more.

Notifications You must be signed in to change notification settings

fedev521/go-boilerplate

Repository files navigation

Go Boilerplate

Features:

  • Dockerfile that leverages cache to avoid unnecessary downloads, compilations and tests. It uses a distroless Debian image with non-root user.
  • logging: uses logur as a facade (and adapter) and logrus under the hood. Always uses JSON formatter.
  • configuration: uses viper. Convention: mandatory configuration file named config.toml.
  • flags: with pflag
  • a run() function to facilitate tests.

Instructions

Run with:

cd cmd/myapp
go run .

Build container image with:

# DOCKER_BUILDKIT=1
docker build -t goboilerplate:latest .

Run container with:

docker compose up

TODO

  • devcontainer
  • VSCode launch and task
  • ko
  • graceful degradation
  • HTTP server
  • telemetry
  • helloworld tests

Useful Resources

Heavily inspired by modern-go-application.

About

Go boilerplate code. Features Dockerfile with cache, logging and more.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published