Skip to content

Go CLI Application

Scaffolds a Go CLI application using Cobra for command structure, Viper for configuration management, and log/slog for structured logging. Produces a buildable binary with a root command, version subcommand, config file support, and a Makefile. Optionally includes GoReleaser configuration and a GitHub Actions release workflow.

Namego-cli
Version0.1.0
Categoryapplications
LicenseApache-2.0
Personaengineering
Tagsgo, cli, cobra, viper, slog
Sourcetemplates/go-cli

Render it

Three front doors, one catalog. Pick whichever suits the caller.

# CLI
npx @nanohype/sdk render go-cli --out ./my-app

# SDK
import { LocalSource, renderTemplate } from "@nanohype/sdk";
const result = await renderTemplate(source, "go-cli", variables);

# MCP — from an agent
get_template({ name: "go-cli" })

Prerequisites

ToolVersionWhy
go>=1.24Go compilation and module management
goreleaser (optional)>=2.0Automated release builds (only needed if release config is included)

Variables

Required

ProjectName string
Kebab-case project name, used as binary name and directory Must be lowercase kebab-case starting with a letter.
Org string
GitHub organization or username Must be a valid GitHub org or username.
GoModule string
Full Go module path Must be a valid Go module path.

Optional

Description string — defaults to A CLI application
Short project description for help text and README
IncludeRelease bool — defaults to true
Include GoReleaser configuration and GitHub Actions release workflow
LogFormat enum — defaults to json
Default structured log output format One of: jsontextpretty.

What it produces

16 files. Placeholder names such as __APP_NAME__ are what the renderer substitutes into.

.env.example
.github/workflows/ci.yml
.github/workflows/release.yml
.gitignore
.golangci.yml
.goreleaser.yaml
cmd/root_test.go
cmd/root.go
cmd/version.go
go.mod
go.sum
internal/config/config_test.go
internal/config/config.go
main.go
Makefile
README.md

Composes with

Composites that use it

  • Internal Tool — CLI tool or browser extension backed by MCP servers for internal team use..