-
Notifications
You must be signed in to change notification settings - Fork 17.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
proposal: cmd/go: list versions of go install
-able package
#65350
Comments
@seankhliao What do you dislike about this proposal? |
I don't think go ever needs to build out the full matrix of installable versions, it only needs to check for a single set of versions: the one given or latest. |
I don't want to build them, I want to list them, for a tool which needs to offer the list of installable version tags. |
i said build out the list, not build the code. Go never needs the list that you want. Further conflating packages with module versioning does not seem like a good idea, we already see many issues when people have with overlapping module boundaries. Also, it is entirely possible for a given package path to exist at the "same" version in multiple modules, these do not conflict as long as they're never imported into the same build graoh:
|
I need the list I want, go also never needs the list from This would mirror functionality available in other package-install tools:
Since As for the confusing path specification, that's further justification for this to be information attainable from the toolchain, that way wrapping tools don't have to make a naive implementation of the same functionality that might not have the same consideration as a I think the point of the proposal is clear, thank you for writing out your criticism instead of just leaving a 👎, even if I don't agree with it. |
this is suboptimal, but a real solution using the go toolchain is blocked on golang/go#65350
* use a bodged loop to handle go forge submodules this is suboptimal, but a real solution using the go toolchain is blocked on golang/go#65350 * update e2e to have a go submodule
While the go command has logic to resolve a module for a package, and the go command also has logic to list the available versions of a given module, the two aren't combined anywhere so we'd have to build out new functionality to implement this. I think if we want to build out such a feature there should be significant user demand for it. But I would imagine that most users using go install pkg@version are either using If this information is meant to be used by a tool, I think the best bet would be to make a new temporary module, run Note that that wouldn't be totally complete because the package may not exist at all versions of the module, or there could be other modules that contain the package. |
Proposal Details
When wrapping
go install
for use in https://github.com/jdx/mise, I've run into the issue of not being able to consistently find a list of installable versions for ago install
-able package URL.Example:
go list -m -versions -json github.com/go-task/task/v3/cmd/task
returns:Any software looking to find a list of valid versions for
github.com/go-task/task/v3/cmd/task
I believe has to just check:github.com/go-task/task/v3/cmd/task
github.com/go-task/task/v3/cmd
github.com/go-task/task/v3
before finding the "root" of the module. This is further complicated by the way major versions are incorporated into the path when the module root is not the repository root.
It would be very useful if
go install
could have a flag to list installable versions (with json?), as it does this check somewhere internally to provide it's current functionality of checking if a version is valid.The text was updated successfully, but these errors were encountered: