feat: add --version flag to display binary version#5
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a
--versionflag totile-diffthat displays the current version of the binary, matching the release tag.Changes
versionvariable to main package (default: "dev")--versionboolean flag that prints version and exitsBehavior
Development builds:
Release builds:
Technical Details
-ldflags "-X main.version=$VERSION"git describe --tags --always --dirtyto determine versionTest Plan
./tile-diff --versionworks correctly