Stamp the build version from git instead of a hand-maintained string - #28
Merged
Conversation
version has been a hardcoded literal since day one, only ever correct if someone remembered to pass -ldflags by hand -- which nobody did for tonight's job-sweep deploy, so the running binary claimed "0.1.1" while running code well past v0.2.0. Add scripts/Build-FileMill.ps1, which stamps the binary with `git describe --tags --dirty --always` so --version and the webhook startup line always name the exact commit that was actually built, and point every documented rebuild step (initial setup, the code-change deploy sequence, Start-FileMill.ps1's missing-binary error) at it instead of a bare `go build`. The fallback default changes from the stale "0.1.1" to "dev", so a binary built by hand outside the script is obviously identifiable as unstamped rather than silently claiming a specific version number that will only go stale again the same way. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
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
scripts/Build-FileMill.ps1: buildsbin\filemill.exewith-ldflags "-X main.version=$(git describe --tags --dirty --always)", so--versionand the webhook startup log line always name the exact commit that was built.Start-FileMill.ps1's missing-binary error message.version's fallback default changes from the stale hardcoded"0.1.1"to"dev", so a binary built by hand (bypassing the script) is obviously identifiable as unstamped rather than silently claiming a specific version number that will only drift again the same way it just did.Motivated directly by tonight's job-sweep deploy: the binary running in production right now claims
0.1.1even though it's well pastv0.2.0, because nobody passed-ldflagsby hand for that rebuild — which was always the plan per the original comment onversion, just never actually wired into anything.Test plan
go build ./...,go vet ./...,go test ./... -count=1bin\filemill.exe) and confirmed--versionreportsv0.2.0-2-g847f43b-dirty— correct given 2 commits past thev0.2.0tag and an uncommitted working tree at the time🤖 Generated with Claude Code