A Basic Golang Project Template

I’ve been writing a lot of Golang lately. One thing I’ve missed moving from primarily Rust to primarily Go is the strict compiler rules and linting that come out of the box. However, over the last couple of months, I’ve managed to build a decent set of starting materials for getting off the ground.

I’ve yet to see a good basic project template for Golang elsewhere that includes these sorts of settings. Most that I have found usually focus on the architecture of the project. While that’s important, I find it’s easier to keep a code base clean and well manicured if it has linting/formatting from the start. I figured I’d distill out the settings I use for linting, modd, and test coverage and throw them into a Git repo for others to use.

You can find the template project here: https://git.sr.ht/~zacbrown/go-project-template/

It includes:

It’s nothing fancy but I’ve been using it in a few places to start new projects.

Posted on 2021-02-19