jdx / mise

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

Go backend: Infinite loop installing non-GitHub-hosted Go package #2254

Open bhollis opened 1 month ago

bhollis commented 1 month ago

I'm having trouble installing the protoc-gen-connect-go Go package, which uses a package path that's not on github.com:

On my mac:

$ mise use --pin go:connectrpc.com/connect/cmd/protoc-gen-connect-go
go: unrecognized import path "connectrpc.com/connect/cmd/protoc-gen-connect-go": reading https://connectrpc.com/connect/cmd/protoc-gen-connect-go?go-get=1: 404 Not Found
go: unrecognized import path "connectrpc.com/connect/cmd": reading https://connectrpc.com/connect/cmd?go-get=1: 404 Not Found
mise go:connectrpc.com/connect/cmd/protoc-gen-connect-go@1.16.2 ✓ installed                                                                                                                                                                 mise ~/Documents/project/.mise.toml tools: go:connectrpc.com/connect/cmd/protoc-gen-connect-go@1.16.2

On my CI machine:

$ go list -m -versions -json connectrpc.com/connect/cmd/protoc-gen-connect-go
go: unrecognized import path "connectrpc.com/connect/cmd/protoc-gen-connect-go": reading https://connectrpc.com/connect/cmd/protoc-gen-connect-go?go-get=1: 404 Not Found

My Go version is 1.22.3, also managed through mise. I would expect that either I wouldn't be able to install this in the first place, or that once installed, other machines would also be able to install it via mise install.

bhollis commented 1 month ago

Note that just running go install connectrpc.com/connect/cmd/protoc-gen-connect-go works with no message and places the protoc-gen-connect-go binary in $GOBIN.

bhollis commented 4 weeks ago

I'm not convinced this is caused by the loop at https://github.com/jdx/mise/blob/main/src/backend/go.rs#L40 - I'm seeing machines dying with hundreds of npm view commands, hundreds of go list commands, etc. So the infinite loop must be somewhere above the backend's loop.

jdx commented 3 weeks ago

infinite loops are generally caused by shims calling themselves. Experimental backends are a work in progress so I'm still working through some of these problems.

bhollis commented 3 weeks ago

That makes sense. Would it work to set an environment variable whenever mise executes other commands that would disable some of the version resolution machinery, to avoid this infinite loop behavior?

jdx commented 3 weeks ago

maybe, but it's harder than it sounds. It's normal for shims to execute other shims.