Skip to content

go/template is a tool for jumpstarting production-ready Golang projects quickly.

License

Notifications You must be signed in to change notification settings

eljoth/go-template

 
 

Repository files navigation

go/template

SIT CI Semgrep Go Report Card

go/template provides a blueprint for production-ready Go project layouts.

go/template logo

Credit to Renée French for the Go Gopher logo
Credit to Go Authors for the official Go logo

Batteries included

  • 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
    • go.uber.org/zap for logging
    • go.uber.org/automaxprocs to be safe in container environments (see this article for more information)

Usage

Installation

From source

If you have Go 1.16+, you can directly install by running:

go install github.com/schwarzit/go-template/cmd/gt@latest

Based on your go configuration the go/template binary can be found in $GOPATH/bin or $HOME/go/bin in case $GOPATH is not set. Make sure to add the respective directory to your $PATH. For more information see go docs for further information. Run go env to view your current configuration.

From the released binaries

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.

nix

go-template also provides a flake.nix to install it via nix package manager.

You can also try out go-template without installing:

nix run github:schwarzit/go-template

Preconditions

go/template's gt CLI requires at least the following executables on $PATH to run succesfully:

  • Go >= 1.15
  • Git

These are used at the end of gt new's execution to initialize Git and Go modules in the newly created project repository.

Initialize your repo from the template

asciicast

Use the template to generate your repo:

gt new

Initialize the project:

cd <your project>
make all

Options

To 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.

Maintainers

Name Email
@brumhard code@brumhard.com
@linuxluigi steffen.exler@mail.schwarz
@danielzwink daniel.zwink@mail.schwarz

Contribution

If you want to contribute to go/template please have a look at our contribution guidelines.

Releasing

The release process is described in the release docs.

About

go/template is a tool for jumpstarting production-ready Golang projects quickly.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Go 85.8%
  • Makefile 8.5%
  • Shell 2.7%
  • Nix 1.7%
  • Dockerfile 1.3%