Skip to content

Conversation

@malston
Copy link
Owner

@malston malston commented Dec 15, 2025

Summary

Adds a --version flag to tile-diff that displays the current version of the binary, matching the release tag.

Changes

  • Added version variable to main package (default: "dev")
  • Added --version boolean flag that prints version and exits
  • Updated Makefile to inject version from git tags using ldflags
  • Added acceptance test for version flag functionality

Behavior

Development builds:

$ tile-diff --version
tile-diff version v0.3.0-phase3-98-gea79a59-dirty

Release builds:

$ tile-diff --version
tile-diff version v1.0.0

Technical Details

  • Version is injected at build time via -ldflags "-X main.version=$VERSION"
  • Makefile uses git describe --tags --always --dirty to determine version
  • Release workflow already had proper ldflags setup, no changes needed
  • Follows TDD: test written first, implementation followed, all tests passing

Test Plan

  • Unit tests pass
  • Acceptance test for version flag passes
  • Manual verification: ./tile-diff --version works correctly
  • Build process injects version from git tags

Add --version flag that displays the current version of tile-diff.
The version is injected at build time via ldflags from git tags.

Changes:
- Add version variable with default value "dev"
- Add --version boolean flag to main.go
- Update Makefile to inject version using git describe
- Add acceptance test for version flag functionality

During development builds, the version shows git describe output
(e.g., v0.3.0-phase3-98-gea79a59-dirty). During releases, the
version shows the clean tag (e.g., v1.0.0).

The release workflow already uses ldflags for version injection,
so no changes were needed there.
Add PIVNET_MIN_FREE_SPACE_GB environment variable to allow overriding
the minimum free disk space requirement for tile downloads.

Changes:
- Add PIVNET_MIN_FREE_SPACE_GB env var parsing in main.go
- Default to 5GB (reduced from hardcoded 20GB)
- Set to 2GB in CI workflow to prevent disk space failures
- Update CI workflow to test --version flag now that it exists

This fixes the "fails with meaningful error for invalid Pivnet token"
acceptance test failure in CI, which was failing on disk space check
before it could reach the authentication step.

The lower default (5GB) is more reasonable for most use cases, and
the environment variable allows users to adjust based on their needs.
Most tiles are < 5GB but some exceed 10GB. The 10GB default provides
a good buffer for most cases while users can override via
PIVNET_MIN_FREE_SPACE_GB for larger tiles.
@malston malston merged commit eb5a4d0 into main Dec 15, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants