go/template provides a blueprint for production-ready Go project layouts.
Credit to Renée French for the Go Gopher logo Credit to Go Authors for the official Go logo
- Makefile for most common tasks
- optimized Dockerfile
- golangci-lint default configuration
- pre-push git hook to ensure no linting issues
- gRPC support
- folder structure based on github.com/golang-standards/project-layout
- enforced default packages
log/slogfor logginggo.uber.org/automaxprocsto be safe in container environments (see this article for more information)
If you have Go 1.21+, you can directly install by running:
go install github.com/schwarzit/go-template/cmd/gt@latestBased on your go configuration the
go/templatebinary can be found in$GOPATH/binor$HOME/go/binin case$GOPATHis not set. Make sure to add the respective directory to your$PATH. For more information see go docs for further information. Rungo envto view your current configuration.
Download the desired version for your operating system and processor architecture from the go-template releases page.
Make the file executable and place it in a directory available in your $PATH.
go/template's gt CLI requires at least the following executables on $PATH to run succesfully:
- Go >= 1.21
- Git
These are used at the end of gt new's execution to initialize Git and Go modules in the newly created project repository.
Use the template to generate your repo:
gt newInitialize the project:
cd <your project>
make allTo get an overview of all options that can be set for the template you can take a look at the options docs, run the CLI or check out the testing example values file.
If you want to contribute to go/template please have a look at our contribution guidelines.
The release process is described in the release docs.