cli + tui to publish to leaflet (wip) & manage tasks, notes & watch/read lists 🍃
charm leaflet readability golang

title: Building Noteleaf sidebar_label: Building sidebar_position: 1 description: Build configurations and development workflows.#

Building Noteleaf#

Noteleaf uses Task for build automation, providing consistent workflows across development, testing, and releases.

Prerequisites#

  • Go 1.21 or later
  • Task (install via brew install go-task/tap/go-task on macOS)
  • Git (for version information)

Build Types#

Development Build#

Quick build without version injection for local development:

task build

Output: ./tmp/noteleaf

Development Build with Version#

Build with git commit hash and development tools enabled:

task build:dev

Version format: git describe output (e.g., v0.1.0-15-g1234abc) Output: ./tmp/noteleaf

Release Candidate Build#

Build with -rc tag, excludes development tools:

git tag v1.0.0-rc1
task build:rc

Requirements:

  • Clean git tag with -rc suffix
  • Tag format: v1.0.0-rc1, v2.1.0-rc2, etc.

Production Build#

Build for release with strict validation:

git tag v1.0.0
task build:prod

Requirements:

  • Clean semver git tag (e.g., v1.0.0, v2.1.3)
  • No uncommitted changes
  • No prerelease suffix

Build Tags#

Production builds use the prod build tag to exclude development and seed commands:

//go:build !prod

Commands excluded from production:

  • noteleaf dev - Development utilities
  • noteleaf seed - Test data generation

Version Information#

Build process injects version metadata via ldflags:

// internal/version/version.go
var (
    Version   = "dev"           // Git tag or "dev"
    Commit    = "none"          // Git commit hash
    BuildDate = "unknown"       // Build timestamp
)

View version information:

task version:show
noteleaf version

Build Artifacts#

All binaries are built to ./tmp/ directory:

tmp/
└── noteleaf    # Binary for current platform

Development Workflow#

Full development cycle with linting and testing:

task dev

Runs:

  1. Clean build artifacts
  2. Run linters (vet, fmt)
  3. Execute all tests
  4. Build binary

Manual Build#

Build directly with Go (bypasses Task automation):

go build -o ./tmp/noteleaf ./cmd

With version injection:

go build -ldflags "-X github.com/stormlightlabs/noteleaf/internal/version.Version=v1.0.0" -o ./tmp/noteleaf ./cmd

Cross-Platform Builds#

Build for specific platforms:

# Linux
GOOS=linux GOARCH=amd64 go build -o ./tmp/noteleaf-linux ./cmd

# Windows
GOOS=windows GOARCH=amd64 go build -o ./tmp/noteleaf.exe ./cmd

# macOS (ARM)
GOOS=darwin GOARCH=arm64 go build -o ./tmp/noteleaf-darwin-arm64 ./cmd

Clean Build#

Remove all build artifacts:

task clean

Removes:

  • ./tmp/ directory
  • coverage.out and coverage.html