A template for building a CLI application build with Go and Urfave CLI.
  • Go 54.3%
  • Just 45.7%
Find a file
Oliver Andrich 16722816d8
chore: remove commented-out zig cross-compilation from goreleaser
CGO is disabled; the zig/clang CC/CXX block is dead weight.
2026-02-07 14:13:17 +01:00
cmd/__ProjectName__ chore: initial commit 2026-01-28 11:16:02 +01:00
internal/example chore: initial commit 2026-01-28 11:16:02 +01:00
.gitignore chore: add .claude/ to gitignore 2026-01-31 21:11:56 +01:00
.gohatch.toml chore: initial commit 2026-01-28 11:16:02 +01:00
.golangci.yml chore: initial commit 2026-01-28 11:16:02 +01:00
.goreleaser.yaml chore: remove commented-out zig cross-compilation from goreleaser 2026-02-07 14:13:17 +01:00
.pre-commit-config.yaml chore: initial commit 2026-01-28 11:16:02 +01:00
go.mod chore: initial commit 2026-01-28 11:16:02 +01:00
go.sum chore: initial commit 2026-01-28 11:16:02 +01:00
justfile feat: enable Codeberg releases with Homebrew cask support 2026-02-01 10:07:01 +01:00
LICENSE chore: initial commit 2026-01-28 11:16:02 +01:00
README.md docs: remove obsolete release-snapshot from README 2026-02-01 10:48:23 +01:00

Go CLI Template

Go Version License Codeberg

A ready-to-use template for Go CLI applications.

Stack

  • Go 1.24+
  • urfave/cli v3 for argument parsing and subcommands
  • just task runner
  • golangci-lint for code quality
  • goreleaser for releases

Quick Start

# Create new project from template
gohatch codeberg.org/oliverandrich/go-cli-template codeberg.org/you/your-app

# Build and run
cd your-app
just build
./build/your-app

Requirements

Template Variables

The template uses placeholders that gohatch replaces automatically:

Placeholder Replaced with
__ProjectName__ Binary name (last path segment)
__ProjectDescription__ Project description (from -d flag)

Development

just setup            # Setup project (download deps, install pre-commit hooks)
just build            # Build binary to build/<name>
just test             # Run tests
just cover            # Run tests with coverage
just cover-report     # Open coverage report in browser
just fmt              # Format code
just lint             # Run linter
just check            # Run fmt, lint, and test
just clean            # Remove build artifacts
just install          # Install to $GOPATH/bin
just release          # Create release with goreleaser

Project Structure

├── cmd/
│   └── __ProjectName__/    # CLI entry point
│       └── main.go
├── internal/               # Internal packages
│   └── example/            # Example package
├── go.mod
├── justfile                # Task runner
├── .golangci.yml           # Linter config
└── .goreleaser.yml         # Release config

License

EUPL-1.2 - see LICENSE