-
-
Notifications
You must be signed in to change notification settings - Fork 9
Description
What is the problem?
Thanks for this utility - it's really slick!
I used to manage multiple go versions via go.dev instructions, installing all my versions in ~/sdk/go/<version>.
In with that, I would have my most-used go version wired up to GOROOT via my .zshrc file like export GOROOT=~/sdk/go/1.22.9, and in my editor (vscode - sorry, not cool enough for vim yet 😅) I'd have it wired up like "go.goroot": "/path/to/sdk/go/1.22.9" in workspace or profile settings.
I started using govm hoping it would make it easier to auto-wire stuff upon switching go versions.
I removed the export GOROOT= line from my .zshrc to test this out, then went to a go project and tried to do go run ./main.go. This results in errors:
go run ./main.go
cmd/main.go:4:2: package context is not in std (/Users/bgore/.govm/shim/src/context)
... many more similar errors
However, if I run it with GOROOT set to the path of the desired go version, it works fine:
GOROOT=/Users/bgore/.govm/versions/go1.23.7 go run ./main.go
Wondering if either I'm just missing something dumb that would already make this easier, or if it would make sense to update the shim to set the GOROOT for the actual call to go once it finds the currently in use version.
Thanks again 😄
Operating System
macOS Sonoma 14.7.4
Architecture Version (x86, x64, arm, etc)
arm
Steps to reproduce
- Use
govmto switch to a given version ofgo - Do not have
.bashrc | .zshrc | etc..auto-wireGOROOTto any specific go version. - Navigate to a local go package that pulls in packages from std lib and try to
go runit - should get errors about package missing from std lib. - Define
GOROOTfor the call togo runas inGOROOT=path/to/.govm/versions/<version> go run ./main.goand see that it runs.