Opinionated Go project template with a battle-tested CI pipeline.
- Click Use this template on GitHub (or
gh repo create --template matthewjhunter/template-go) - Rename
cmd/appname/to match your binary name - Update
modulepath ingo.mod - Update
BINARYinTaskfile.yml,main/binaryin.goreleaser.yml, and the binary name in.gitignore - Update
REPO_NAMEinSECURITY.md - Run
task hooks:installto set up git hooks
All jobs run on every push to main and on pull requests:
| Job | What it does |
|---|---|
| test | go test -race -count=1 ./... — race detector enabled, no test caching |
| vet | go vet ./... — built-in static analysis |
| fmt | gofmt -l . — enforces canonical formatting |
| lint | golangci-lint v2 with focused linter set (govet, staticcheck, unused, ineffassign) |
| govulncheck | Scans stdlib and dependencies for known vulnerabilities |
A Taskfile wraps all CI checks for local use:
task check # Run all CI checks locally
task test # Tests with race detector
task lint # golangci-lint
task vulncheck # govulncheckTwo git hooks keep code clean locally:
- Pre-commit: auto-formats staged
.gofiles withgofmt - Pre-push: runs test, vet, lint, and govulncheck before pushing
Install both with:
task hooks:installTag a version to trigger a release build via GoReleaser:
git tag v0.1.0
git push origin v0.1.0Builds cross-platform binaries (linux/darwin, amd64/arm64) with checksums and a changelog.
Dependabot is configured for weekly updates to both Go modules and GitHub Actions.
SECURITY.md— vulnerability reporting instructions via GitHub's private advisory system- Issue templates — structured bug report and feature request forms
cmd/appname/ # CLI entrypoint (rename to your binary)
internal/ # Private packages
githooks/ # Git hooks (install with task hooks:install)
- Linters: Edit
.golangci.ymlto enable additional linters - CI triggers: Edit
.github/workflows/ci.ymlto add branch patterns - Release targets: Edit
.goreleaser.ymlto add OS/arch combinations or change the archive format - System dependencies: If your project needs C libraries, add an
apt-get installstep to the test, vet, lint, and govulncheck jobs
MIT