Repository navigation
fix: use string literals for mage alias keys - #8296
Merged
Merged
Conversation
Mage only discovers aliases whose keys are string literals; using the cmdBuild/cmdTest constants silently dropped the build and test aliases. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Contributor
|
This pull request does not have a backport label. Could you fix it @macdewee? 🙏
|
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues were identified for the change restoring Fleet Server’s Mage build and test aliases.
No open issues 🎉
What changed in this PR
Restores Fleet Server’s mage build and mage test aliases after #8248 replaced their string-literal keys with constants that Mage’s alias parser skips.
Changes:
- Restores literal keys mapping
buildtoBuild.BinaryandtesttoTest.All. - Documents Mage’s literal-key requirement and adds a targeted
goconstsuppression for"build".
| File | Description |
|---|---|
magefile.go |
Restores discoverable alias keys and documents why constants cannot be used. |
Review effort: Balanced
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Contributor
|
This pull request is merged. |
macdewee
enabled auto-merge (squash)
November 19, 2026 13:55
macdewee
disabled auto-merge
November 19, 2026 13:57
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
macdewee
enabled auto-merge (squash)
November 19, 2026 14:46
ycombinator
approved these changes
Nov 20, 2026
ycombinator
left a comment
Contributor
There was a problem hiding this comment.
Confirmed by looking at output of mage -v build and mage -v test on this PR. LGTM.
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.
What is the problem this PR solves?
#8248 replaced the
"build"and"test"keys of theAliasesmap inmagefile.gowith thecmdBuildandcmdTestconstants to satisfygoconst. Mage only discovers aliases whose keys are string literals (parse.gorequires an*ast.BasicLitkey and otherwise logswarning: alias key is not a string literaland skips it), so thebuildandtestaliases were silently dropped.How does this PR solve the problem?
Restores the string-literal keys. The
"build"key keeps a//nolint:goconstwith an explanation, and a comment aboveAliasesexplains why the constants must not be used there."test"needs nonolint(nolintlintreports it as unused). The constants stay in use elsewhere in the file.The same change is already included in the backports of #8248 (#8286, #8287, #8288, #8289).
How to test this PR locally
Run
mage check:go; it should pass. The alias keys are plain string literals again, somage buildandmage testresolve tobuild:binaryandtest:allas before #8248.Checklist
Related issues
🤖 Generated with Claude Code