Skip to content

proposal: cmd/go: list versions of go install-able package #65350

@endigma

Description

@endigma

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 a go install-able package URL.

Example:

go list -m -versions -json github.com/go-task/task/v3/cmd/task returns:

{
        "Path": "github.com/go-task/task/v3/cmd/task",
        "Origin": {
                "VCS": "git",
                "URL": "https://github.com/go-task/task",
                "Subdir": "v3/cmd/task",
                "TagPrefix": "v3/cmd/task/",
                "TagSum": "t1:47DEQpj8HBSa+/TImW+5JCeuQeRkm5NMpJWZG3hSuFU="
        }
}

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    Incoming

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions