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
govm to switch to a given version of go
- Do not have
.bashrc | .zshrc | etc.. auto-wire GOROOT to any specific go version.
- Navigate to a local go package that pulls in packages from std lib and try to
go run it - should get errors about package missing from std lib.
- Define
GOROOT for the call to go run as in GOROOT=path/to/.govm/versions/<version> go run ./main.go and see that it runs.
Relevant log output
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
GOROOTvia my.zshrcfile likeexport 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
govmhoping it would make it easier to auto-wire stuff upon switching go versions.I removed the
export GOROOT=line from my.zshrcto test this out, then went to a go project and tried to dogo run ./main.go. This results in errors:However, if I run it with
GOROOTset to the path of the desired go version, it works fine: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
GOROOTfor the actual call togoonce 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
govmto switch to a given version ofgo.bashrc | .zshrc | etc..auto-wireGOROOTto any specific go version.go runit - should get errors about package missing from std lib.GOROOTfor the call togo runas inGOROOT=path/to/.govm/versions/<version> go run ./main.goand see that it runs.Relevant log output