Template to quickly spin up a Go module project.
- Go modules enabled.
- Template for README, LICENSE, RELEASE-NOTES, and .gitignore files.
- GitHub actions included:
dependabot.yaml,automerge-dependabot.yaml: automatically update dependencies and merge PRs from dependabot.ci.yaml: automatically run tests and generate code coverage report.release.yaml: automatically create a new release.codeql.yaml: automatically run CodeQL analysis.
- Create new project from this template:
- Click on the
Use this templatebutton to create a new repository from this template. - Or use the
ghcommand line tool:gh repo create <your-repository> --template btnguyen2k/go-module-template - (Less preferred method) Or simply clone/fork this repository.
- Click on the
- Update
go.modandmodule.gofile to reflect your module name and required Go version. - Review other source code and test files, either update them to reflect your module's name and functionality or remove them.
LICENSE.tpl.md,README.tpl.mdandRELEASE-NOTES.tpl.mdfiles are templates; update them to reflect your module's name and functionality; then rename them toLICENSE.md,README.mdandRELEASE-NOTES.md.- Update other files to suit your needs.
- Happy coding!
Workflows
Workflows implemented by this template are as the following:
dependabot.yamlconfigures dependencies are checked and updated weekly.dependabotwill create a PR for each dependency update.automerge-dependabot.yamlis triggered to automatically merged PRs tomainbranch.codeql.yamlis triggered on every push, pr and periodically to run CodeQL analysis.ci.yamlis triggered on every push to any branch to run tests and generate code coverage report.- Once PR is approved and merged to
releasebranch,release.yamlis triggered to create a new release. Then a new PR is created to mergereleasebranch tomainbranch.
A suggested git workflow to use with this template is as the following:
- Work on your code in development/feature branches as usual.
- Once ready, create a PR to merge your development/feature branch to
releasebranch.- Once the PR is merged,
release.yamlis triggered to create a new release. - Then a new PR is created to merge
releasebranch tomainbranch. Note: you have to review and approve the PR by yourself to finalize the merge.
- Once the PR is merged,
Remember to enable the setting "Allow GitHub Actions to create and approve pull requests" from project's
Settings -> Actions -> General.
This template is licensed under the MIT License - see the LICENSE.md file for details.
Feel free to create pull requests or issues to report bugs or suggest new features. If you find this project useful, please star it.