jdx / mise

dev tools, env vars, task runner
https://mise.jdx.dev
MIT License
10.19k stars 293 forks source link

Feedback on experimental Go plugin #2883

Open powerman opened 3 weeks ago

powerman commented 3 weeks ago

It works great and let me install 47 extra tools in a safe (non-asdf) way!

The main issue I have with it is extra slowdown and useless errors output because of making wrong (for Go) requests.

Example 1 - stdlib extension with version tag:

$ mise i go:golang.org/x/tools/cmd/stringer
go: module golang.org/x/tools/cmd/stringer: git ls-remote -q origin in /home/powerman/go/pkg/mod/cache/vcs/7d9b3b49b55db5b40e68a94007f21a05905d3fda866f685220de88f9c9bad98a: exit status 128:
    remote: INVALID_ARGUMENT: Request contains an invalid argument
    remote: [type.googleapis.com/google.rpc.LocalizedMessage]
    remote: locale: "en-US"
    remote: message: "Invalid authentication credentials. Please generate a new identifier: https://go.googlesource.com/new-password"
    remote: 
    remote: [type.googleapis.com/google.rpc.RequestInfo]
    remote: request_id: "c1616b144eee4c3a98b669714dd590df"
    fatal: unable to access 'https://go.googlesource.com/tools/': The requested URL returned error: 400
go: module golang.org/x/tools/cmd: git ls-remote -q origin in /home/powerman/go/pkg/mod/cache/vcs/7d9b3b49b55db5b40e68a94007f21a05905d3fda866f685220de88f9c9bad98a: exit status 128:
    remote: INVALID_ARGUMENT: Request contains an invalid argument
    remote: [type.googleapis.com/google.rpc.LocalizedMessage]
    remote: locale: "en-US"
    remote: message: "Invalid authentication credentials. Please generate a new identifier: https://go.googlesource.com/new-password"
    remote: 
    remote: [type.googleapis.com/google.rpc.RequestInfo]
    remote: request_id: "5e961b34d76b4a2f8330a508077f2bd6"
    fatal: unable to access 'https://go.googlesource.com/tools/': The requested URL returned error: 400
mise go:golang.org/x/tools/cmd/stringer@0.26.0 ✓ installed
$

Example 2 - stdlib extension, no version tag:

$ mise i go:golang.org/x/pkgsite/cmd/pkgsite
go: module golang.org/x/pkgsite/cmd/pkgsite: git ls-remote -q origin in /home/powerman/go/pkg/mod/cache/vcs/d8f05a36be9398af0a113ddaae73ff3b3b68353140c4454633da48827fa51076: exit status 128:
    remote: INVALID_ARGUMENT: Request contains an invalid argument
    remote: [type.googleapis.com/google.rpc.LocalizedMessage]
    remote: locale: "en-US"
    remote: message: "Invalid authentication credentials. Please generate a new identifier: https://go.googlesource.com/new-password"
    remote: 
    remote: [type.googleapis.com/google.rpc.RequestInfo]
    remote: request_id: "8c445a2bd7844db29b639faa95954e7e"
    fatal: unable to access 'https://go.googlesource.com/pkgsite/': The requested URL returned error: 400
go: module golang.org/x/pkgsite/cmd: git ls-remote -q origin in /home/powerman/go/pkg/mod/cache/vcs/d8f05a36be9398af0a113ddaae73ff3b3b68353140c4454633da48827fa51076: exit status 128:
    remote: INVALID_ARGUMENT: Request contains an invalid argument
    remote: [type.googleapis.com/google.rpc.LocalizedMessage]
    remote: locale: "en-US"
    remote: message: "Invalid authentication credentials. Please generate a new identifier: https://go.googlesource.com/new-password"
    remote: 
    remote: [type.googleapis.com/google.rpc.RequestInfo]
    remote: request_id: "e6fb9b06c47443a7a8e07c04fab8f1c9"
    fatal: unable to access 'https://go.googlesource.com/pkgsite/': The requested URL returned error: 400
go: unrecognized import path "golang.org/x": parse https://golang.org/x?go-get=1: no go-import meta tags ()
go: unrecognized import path "golang.org": parse https://golang.org/?go-get=1: no go-import meta tags ()
mise WARN  No versions found for go:golang.org/x/pkgsite/cmd/pkgsite
go: golang.org/x/pkgsite/cmd/pkgsite@vlatest: golang.org/x/pkgsite/cmd/pkgsite@vlatest: invalid version: git ls-remote -q origin in /home/powerman/go/pkg/mod/cache/vcs/d8f05a36be9398af0a113ddaae73ff3b3b68353140c4454633da48827fa51076: exit status 128:
    remote: INVALID_ARGUMENT: Request contains an invalid argument
    remote: [type.googleapis.com/google.rpc.LocalizedMessage]
    remote: locale: "en-US"
    remote: message: "Invalid authentication credentials. Please generate a new identifier: https://go.googlesource.com/new-password"
    remote: 
    remote: [type.googleapis.com/google.rpc.RequestInfo]
    remote: request_id: "705f30d4aecd4d238b4e3472d1348dda"
    fatal: unable to access 'https://go.googlesource.com/pkgsite/': The requested URL returned error: 400
mise ERROR go failed
go: golang.org/x/pkgsite/cmd/pkgsite@vlatest: golang.org/x/pkgsite/cmd/pkgsite@vlatest: invalid version: git ls-remote -q origin in /home/powerman/go/pkg/mod/cache/vcs/d8f05a36be9398af0a113ddaae73ff3b3b68353140c4454633da48827fa51076: exit status 128:
    remote: INVALID_ARGUMENT: Request contains an invalid argument
    remote: [type.googleapis.com/google.rpc.LocalizedMessage]
    remote: locale: "en-US"
    remote: message: "Invalid authentication credentials. Please generate a new identifier: https://go.googlesource.com/new-password"
    remote: 
    remote: [type.googleapis.com/google.rpc.RequestInfo]
    remote: request_id: "705f30d4aecd4d238b4e3472d1348dda"
    fatal: unable to access 'https://go.googlesource.com/pkgsite/': The requested URL returned error: 400
mise WARN  Failed to install, trying again without added 'v' prefix
mise go:golang.org/x/pkgsite/cmd/pkgsite@latest ✓ installed                                         
$ 

BTW, Mise may use same versioning as Go uses - this way it'll be able to install different versions of a tool even if it does not use v-tags. For this tool Go version is "v0.0.0-20241004190937-78391ec0fb95" (see https://pkg.go.dev/golang.org/x/pkgsite/cmd/pkgsite?tab=versions).

Example 3 - github:

$ mise i go:github.com/koron/iferr
go: invalid github.com import path "github.com/koron"
go: invalid github.com import path "github.com"
mise WARN  No versions found for go:github.com/koron/iferr
go: github.com/koron/iferr@vlatest: github.com/koron/iferr@vlatest: invalid version: unknown revision vlatest
mise ERROR go failed
go: github.com/koron/iferr@vlatest: github.com/koron/iferr@vlatest: invalid version: unknown revision vlatest
mise WARN  Failed to install, trying again without added 'v' prefix
mise go:github.com/koron/iferr@latest ✓ installed

Example 4 - non stdlib, non github:

$ mise i go:rsc.io/rf
go: rsc.io is not a module
mise WARN  No versions found for go:rsc.io/rf
go: rsc.io/rf@vlatest: rsc.io/rf@vlatest: invalid version: unknown revision vlatest
mise ERROR go failed
go: rsc.io/rf@vlatest: rsc.io/rf@vlatest: invalid version: unknown revision vlatest
mise WARN  Failed to install, trying again without added 'v' prefix
mise go:rsc.io/rf@latest          ✓ installed

It's a bit annoying to get all these screens full of errors from mise outdated.

A lot of other Go tools are installed without these issues.

powerman commented 3 weeks ago

This may (or may not) be related: https://go.dev/ref/mod#serving-from-proxy

powerman commented 3 weeks ago

Or this: https://go.dev/ref/mod#vcs-find

powerman commented 3 weeks ago

Related: https://github.com/jdx/mise/issues/2766