Closed endigma closed 9 months ago
This may also fail where a repository has no tags or has the go package in a non-root directory, as the "Origin" info here doesn't tell us where the go.mod
is.
In the case in OP, the correct command to get the list of versions is go list -m -versions -json github.com/go-task/task/v3
, I don't see how to derive this from the return except for just trying parent directories until a result comes back?
I get the same error when trying to instal connectrpc.com/connect/cmd/protoc-gen-connect-go
through mise's go backend. I've scanned through the go
cli subcommands but there doesn't seem to be a command that translates a package into the module, which go install
does silently.
Should we perhaps open a feature request over at golang/go to add support for this resolving in go list
?
That may actually be the best option, I don't see a way to automatically resolve the module versions from the package path without recursively checking the whole path. Maybe an extra flag for go install
that lists versions would be most likely to be accepted.
This could probably get a "hotfix" by climbing the path until a valid module is found, this seems to work from my testing, but a better solution is probably possible.
There's now an issue in https://github.com/golang/go, but the hotfix is likely much more likely to work on a quick timeline.
lol that thread could not be more stereotypical for go. I hope you get some traction. It seems crazy to me that go install
takes versions as input but there is no way to get the possible options.
This is because
go list -m -versions -json github.com/go-task/task/v3/cmd/task
returnsI originally added the forge, so I'll probably fix this myself, but I don't have time for it right this moment so someone else can get it if they want to.
Solution will probably involve somehow resolving which type of JSON comes back and somehow retrying with the module directory.