Skip to content

Add version suffix to gomod and cargo add - #41

Merged
andrew merged 3 commits into
mainfrom
add-version-suffix
Sep 16, 2026
Merged

andrew merged 3 commits into
mainfrom
add-version-suffix

Conversation

@andrew

@andrew andrew commented Sep 15, 2026

Copy link
Copy Markdown
Contributor

AddOptions.Version was silently dropped for gomod and cargo because
their add.args declared no version arg. Add it with suffix "@" to
match npm.yaml, so mgr.Add builds go get pkg@v and cargo add pkg@v.

Fixes #38


Stack created with GitHub Stacks CLIGive Feedback 💬

AddOptions.Version was silently dropped for gomod and cargo because
their add.args declared no version arg. Add it with suffix "@" to
match npm.yaml, so mgr.Add builds `go get pkg@v` and `cargo add pkg@v`.

Fixes #38
@andrew
andrew added this pull request to stack #43 September 15, 2026 18:18
@andrew
andrew requested a lite review from Copilot September 15, 2026 18:20

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

applyVersionSuffix found the package by string-matching argv, so a
package name equal to the binary or a base subcommand (a crate named
"add" or "cargo", an npm package named "install") had the wrong token
rewritten. Record the index where the package positional is appended
and rewrite that element directly.
processArg left the index at -1 for a package arg declared with Flag,
so a definition combining a flagged package with a suffix version lost
the version. Set the index to the appended value in that branch too.

PackageBlocklistPolicy exact-matched op.Packages entries, so a
versioned positional such as `go get pkg@v1.2.3` bypassed a blocklist
keyed on the bare name. Check the bare form (before the last @) as
well, preserving the leading @ of npm scoped names.
@andrew
andrew marked this pull request as ready for review September 15, 2026 20:38
@andrew
andrew merged commit 3d8ec35 into main Sep 16, 2026
5 checks passed
@andrew
andrew deleted the add-version-suffix branch September 16, 2026 07:07
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.

gomod add drops AddOptions.Version

2 participants