(opens in a new tab) (opens in a new tab) (opens in a new tab) (opens in a new tab) (opens in a new tab) (opens in a new tab) (opens in a new tab)
🧩 Tool
Template for a typical CLI-tool written on Go.
🛫 Quick start
Work with Makefile
$ make setup
$ make help
$ make find-todos
$ make test lint
$ TIMEOUT=5s make test-with-coverage
For more details please visit the page (opens in a new tab).
Work with Taskfile
$ alias run=./Taskfile
$ run refresh
$ run help
$ run docs # === `run docs install -- build -- start`
$ run docs npm ci
$ run docs npm i nextra@latest
$ run tools go generate tools.go
$ run tools golangci-lint --version -- mockgen --version
$ run which goimports golangci-lint govulncheck mockgen
For more details please visit the page (opens in a new tab).
Work with Tools
$ make tools
$ source bin/activate
$ which goimports
$ goimports -local $(go list -m) -w ./...
For more details please visit the page (opens in a new tab).
Work with Docker
$ make go-1.19 # or go-1.20, etc.
/src# make go-env 2>/dev/null | grep GOVERSION
# GOVERSION: 1.19.10
/src# make test
💡 Idea
Define a powerful template that quickly creates a new Go CLI-tool. Not only does it provide a starting point for new projects, but it comes equipped with pre-configured ci/cd and inventory.
$ tool do action
🏆 Motivation
At OctoLab (opens in a new tab), we want to start new projects faster using best practices with a predefined structure and focusing on core ideas implementation rather than wasting time on environment configuration and copying boilerplate code.
🤼 How to
Build your own tool
- Generate (opens in a new tab) a new repository from the template.
- Clone the repository locally.
- Update the desired files as needed, e.g.,
run init my.new/tool
. - Write your code and tests.
- 🚀
Contribute to the template
- Read the contribution guidelines (opens in a new tab).
- Fork (opens in a new tab) the repository.
- Make your changes.
- Send a pull request.
- 🤗
Before you start, please make sure your changes are in demand. The best for that is to create a new discussion (opens in a new tab), or if you find an issue, report it (opens in a new tab) first.
🎛️ Configuration
Pre-configured
- GitHub Actions (opens in a new tab).
- GitHub Pages (opens in a new tab).
- Dependabot (opens in a new tab).
Included
- Nextra (opens in a new tab).
- Makefiles (opens in a new tab).
- Taskfiles (opens in a new tab).
- Go tools (opens in a new tab): mockgen (opens in a new tab), golangci-lint (opens in a new tab), goreleaser (opens in a new tab), godownloader (opens in a new tab), goimports (opens in a new tab), govulncheck (opens in a new tab).
Optional
- Bitbucket (opens in a new tab)1.
- Codecov (opens in a new tab).
- Slack (opens in a new tab).
- Settings (opens in a new tab)2.
- Go Report Card (opens in a new tab).
- Shields.io (opens in a new tab).
- GitHub Socialify (opens in a new tab).
Coming soon
- CodeQL (opens in a new tab) (code scanning).
- Graphite (opens in a new tab) (git workflow).
- Qodana (opens in a new tab) (code quality).
- SonarCloud (opens in a new tab) (code quality).
- Vanity URL (opens in a new tab) (canonical import path).
- Vercel (opens in a new tab) (docs preview).
🛬 Installation
Homebrew
$ brew install octolab/tap/tool
For more details please visit the page (opens in a new tab).
Binary
$ curl -fsSL https://install.octolab.org/tool | sh
# or
$ wget -qO- https://install.octolab.org/tool | sh
For more details please visit the page (opens in a new tab).
Source
# use standard go tools
$ go get go.octolab.org/template/tool@latest
# or use egg tool
$ egg tools add go.octolab.org/template/tool@latest
For more details please visit the page (opens in a new tab).
Shell completions
$ tool completion > /path/to/completions/...
# or
$ source <(tool completion)
🏗️ Ecosystem
Input
- https://github.com/kamilsk/check (opens in a new tab)
- https://github.com/kamilsk/egg (opens in a new tab)
- https://github.com/kamilsk/forward (opens in a new tab)
- https://github.com/kamilsk/lift (opens in a new tab)
- https://github.com/octomation/go-module (opens in a new tab)
Impact
- https://github.com/octomation/maintainer (opens in a new tab)
- https://github.com/octomation/install (opens in a new tab)
- https://github.com/octomation/makefiles (opens in a new tab)
- https://github.com/octomation/taskfiles (opens in a new tab)
- https://github.com/octomation/vanity (opens in a new tab)
Actions
🚧 Work in progress.- https://github.com/octomation/goimports-action (opens in a new tab)
- https://github.com/octomation/settings-action (opens in a new tab)
Custom forks
- https://github.com/kamilsk/go-tools (opens in a new tab)
- https://github.com/kamilsk/godownloader (opens in a new tab)
- https://github.com/kamilsk/golangci-lint (opens in a new tab)
Output
- https://github.com/kamilsk/bridge (opens in a new tab)
- https://github.com/kamilsk/grafaman (opens in a new tab)
- https://github.com/octolab/breakit (opens in a new tab)
- https://github.com/octolab/genome (opens in a new tab)*
- https://github.com/octolab/parallel (opens in a new tab)*
- https://github.com/octolab/testit (opens in a new tab)
- https://github.com/octolab/try (opens in a new tab)*
- https://github.com/octomation/dotapps (opens in a new tab)
- https://github.com/tact-app/airseat (opens in a new tab)
- https://github.com/tact-app/fiddle (opens in a new tab)
- https://github.com/tact-app/loop (opens in a new tab)
- https://github.com/tact-app/secret (opens in a new tab)
made with ❤️ for everyone by OctoLab
Footnotes
-
An alternative for backup could be GitLab (opens in a new tab), Gogs (opens in a new tab), or Gitea (opens in a new tab). ↩
-
It has been deprecated and will be replaced someday by GitHub Actions (opens in a new tab). ↩