Add version suffix to gomod and cargo add - #41
Merged
Merged
Conversation
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
added this pull request to stack #43
September 15, 2026 18:18
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.
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.
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@vandcargo add pkg@v.Fixes #38
Stack created with GitHub Stacks CLI • Give Feedback 💬