go-bootstrap
Template repository for common Go setups
Features
-
GitHub Workflows
- Build (Go & Docker image)
- Test (including CodeClimate)
- Lint (Go)
- Release (Goreleaser & Changelog generator)
-
GitHub issue templates
- PR template
- Issue templates using GitHub issue forms
-
Goreleaser
- Go build for
amd64
,armv8
- Docker build for
latest
andvx.y.z
tags - Push Docker image to GitHub's registry
ghcr.io
- Go build for
-
Antora documentation
- Build default documentation with VSHN styling
- Publish to GitHub Pages by default (opt-out)
- Automated with GitHub workflows to build in
master
branch and (pre-)releases. - Available
make
targets are prefixed withdocs-
-
Local Kubernetes environment
- Setup Kubernetes-In-Docker (kind)
- Prepares a kubeconfig file in
.kind/
- Optionally install NGINX as ingress controller
- Available
make
targets are prefixed withkind-
-
CLI and logging framework
- To help get you started with CLI subcommands, flags and environment variables
- If you don't need subcommands, remove
example_command.go
and adjustcli.App
settings inmain.go
TODO's after generating from this template
TIP: You can search for these tasks using grep -n -r "TODO:" .
go.mod
: Adjust module name..goreleaser.yml
: Adjust Docker image location indockers
anddocker_manifests
parameters..gitignore
: Adjust binary file name.Dockerfile
: Adjust binary file name.Makefile.vars.mk
: Adjust project meta..github/ISSUE_TEMPLATE/config.yml
(optional): Enable forwarding questions to GitHub Discussions or other page..github/workflows/test.yml
: Update CodeClimate reporter ID (to be found in codeclimate.com Test coverage settings)docs/antora.yml
: Adjust project meta.docs/antora-playbook.yml
: Adjust project meta.docs/modules/pages/index.adoc
: Edit start page.docs/modules/nav.adoc
: Edit navigation.main.go
: Adjust variables.- Edit this README (including badges links)
- Start hacking in
example_command.go
.
After completing a task, you can remove the comment in the files.
Other repository settings
-
GitHub Settings
- "Options > Wiki" (disable)
- "Options > Allow auto-merge" (enable)
- "Options > Automatically delete head branches" (enable)
- "Branches > Default branch" (change to
master
) (VSHN's default) - "Branches > Branch protection rules":
- Branch name pattern:
master
- Require status check to pass before merging:
["lint"]
(you may need to push come commits first)
- Branch name pattern:
-
GitHub Issue labels
- "Issues > Labels > New Label" for the following labels with color suggestions:
change
(#D93F0B
)dependency
(#ededed
)breaking
(#FBCA04
)
- "Issues > Labels > New Label" for the following labels with color suggestions:
-
CodeClimate Settings
- "Repo Settings > GitHub > Pull request status updates" (install)
- "Repo Settings > Test coverage > Enforce {Diff,Total} Coverage" (configure to your liking)
Antora documentation
This template comes with an Antora documentation module to help you create Asciidoctor documentation. By default, it is automatically published to GitHub Pages in gh-pages
branch, however it can also be included in external Antora playbooks.
Setup GitHub Pages
Let's prepare and empty gh-pages
branch, but make sure to commit or stash current changes first!
current_branch=$(git rev-parse --abbrev-ref HEAD)
initial_commit=$(git rev-list --max-parents=0 HEAD)
git switch --create gh-pages $initial_commit
git rm -r --cached .
git commit -m "Prepare gh-pages branch"
git push --set-upstream origin gh-pages
git switch -f $current_branch
And you're done! GitHub automatically recognizes and sets up Pages if there's a gh-pages
branch.
If you want to skip deployment to GitHub Pages you need to delete specific files and references: rm -f .github/workflows/docs.yml docs/package*.json docs/antora-playbook.yml docs/antora-build.mk
If you want to remove documentation completely simply run rm -rf docs .github/workflows/docs.yml