Replace bump-version.sh with pure-Go go:generate tool#3272
Draft
Replace bump-version.sh with pure-Go go:generate tool#3272
Conversation
Introduce scripts/bump_version, a combined archival + code-generation tool that replaces the three shell scripts (bump-version.sh, generate-precompile-setup.sh, generate-all-precompiles-setup.sh). New developer workflow: 1. Commit precompile code changes 2. Append a new upgrade name (vMajor.Minor) to app/tags 3. Run go generate ./... What the tool does on each run: - Validates the latest entry in app/tags (must be vMajor.Minor; patch is dropped with a warning; duplicate or regressed versions are errors) - Validates each module's versions file (valid semver, no duplicates) - Uses go-git (pure Go, no os/exec) to find the commit that introduced the previous upgrade version, then diffs per-module tree hashes against HEAD to determine which precompile modules actually changed - Archives changed modules into precompiles/<module>/legacy/<folder>/ with package/import rewrites; archives common/ when it changed (triggers all) - Fails hard on git errors (matching old bump-version.sh set -e behavior) rather than silently falling back to archiving everything - Regenerates precompiles/<module>/setup.go from a text/template (.go.tmpl) for every module with a versions file, formatted via go/format - Is idempotent: skips archival if precompiles/common/legacy/<folder>/ exists Naming conventions enforced: app/tags / versions keys: vMajor.Minor (e.g. v7.0) legacy folder / package: vMajorMinor0 (e.g. v700) All generated .go files carry a "Code generated by scripts/bump_version; DO NOT EDIT." header. Added go-git/v5 as the sole new dependency.
|
The latest Buf updates on your PR. Results from workflow Buf / buf (pull_request).
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3272 +/- ##
==========================================
- Coverage 59.30% 59.19% -0.12%
==========================================
Files 2071 2072 +1
Lines 169814 170141 +327
==========================================
Hits 100707 100707
- Misses 60333 60660 +327
Partials 8774 8774
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
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.
Introduce scripts/bump_version, a combined archival + code-generation tool that replaces the three shell scripts (bump-version.sh, generate-precompile-setup.sh, generate-all-precompiles-setup.sh).
New developer workflow:
What the tool does on each run:
Naming conventions enforced:
app/tags / versions keys: vMajor.Minor (e.g. v7.0) legacy folder / package: vMajorMinor0 (e.g. v700)
All generated .go files carry a "Code generated by scripts/bump_version; DO NOT EDIT." header. Added go-git/v5 as the sole new dependency.