rtx doesn't update GOPATH in GoLand's terminal #815
Replies: 4 comments 23 replies
-
I'm pretty sure what is happening is Goland sets GOPATH itself. If rtx sets it before, then it feels at liberty to update it but if another tool (or zshrc) sets GOPATH then it does not screw with it. I inherited this behavior from the asdf plugin, but I'm not sure if it's wise or not. It seems there are use-cases where people want to have GOPATH overridden (or even set at all) and use-cases where they don't. What we could do is update this logic a bit to force GOPATH setting if RTX_GO_SET_GOROOT is true: https://github.com/jdxcode/rtx/blob/06f2bef728fc739e8668ce6b9c14134b697e8561/src/plugins/core/go.rs#L182-L198 I'd accept a PR for that. |
Beta Was this translation helpful? Give feedback.
-
Agreed, I think it's more helpful to keep these consistent. If a complex project needed to isolate built binaries, I'd just use "go build -o" and put them somewhere else |
Beta Was this translation helpful? Give feedback.
-
Sure, so if the GoLand terminal GOROOT and path is pointing to go 1.21.6, and then I run mise where I've got it set for 1.22.0, the result is failure:
What's happening, is that MISE is honouring the go tool version, but then it's also trying to honour the terminal GOROOT. But the two don't belong together, so the build fails. This is reproducible after a mise implode. I can sort-of fix this with:
Which I didn't expect to make any difference, because documentation claims this is the default. Though, the environment doesn't seem to apply first time, so I end up having to run my build twice. Second time, mise picks up that it should set the GOROOT. But that's another issue, I guess.
Fair, maybe I worded it poorly. All I really mean is: by default, mise should disregard the host GOROOT value, because it almost never makes sense for GOROOT to differ from the actual go tool being executed I'd go so far as to say it never makes sense at all. What use case for GOROOT to be misconfigured? But, it seems harmless to have an option for it.
Not sure if we're on the same page about what the current behaviour is -- ignored if set? That would give me the behaviour I want! I have reproduced the behaviour above with serveral mise implodes. I'm confident that the default behaviour is that it does inherit the GOROOT and that results in the weirdness above |
Beta Was this translation helpful? Give feedback.
-
For what it's worth, since the Go added forward compatibility and toolchain management in go1.21 (blog post) I stopped trying to mess my environment, just installed go1.21 once and called it a day. I still use mise for env variables and python though :) |
Beta Was this translation helpful? Give feedback.
-
I'm using rtx with fish, it works fine in my usual terminal emulator but fails to update GOPATH and GOROOT in GoLand's integrated terminal emulator.
However, if I launch GoLand from the shell script provided with the JetBrains Toolbox, it works fine.
I have setup
rtx activate
in my fish, bash and zsh config:Did I miss something in my config? Is it a known issue? I read the README about IDE integration but it looks like it applies to running binaries from the IDE, not from terminal emulators in the IDE.
In iTerm2
In Goland (opened as a normal app)
In Goland (opened with the shell alias)
Adding "IntellIJ IDEA" for search purposes.
Beta Was this translation helpful? Give feedback.
All reactions