asdf-golang
asdf-golang copied to clipboard
Not able to disable `ASDF_GOLANG_MOD_VERSION_ENABLED`
Describe the bug
I have disabled ASDF_GOLANG_MOD_VERSION_ENABLED, but still getting the notice when starting my shell.
To Reproduce Steps to reproduce the behavior:
- Add
export ASDF_GOLANG_MOD_VERSION_ENABLED=falsein the shell's configs (.zshrc/equivalent). - Start a new shell.
Expected behavior
I should be able to disable the go.mod version detection (and just use .tool-versions for defining Golang version), without having my shell warning me about a feature I have decided to opt-out of.
Screenshots
Upon starting my shell:
Notice: Behaving like ASDF_GOLANG_MOD_VERSION_ENABLED=true
In the future this will have to be set to continue
reading from the go.mod and go.work files
$ env|grep ASDF_GOLANG_MOD_VERSION_ENABLED
ASDF_GOLANG_MOD_VERSION_ENABLED=false
Additional context
I'm using this version of the plugin:
$ asdf plugin list --refs | grep golang
golang master 3c3674a
i.e:
- https://github.com/asdf-community/asdf-golang/commit/3c3674a
...which includes the change from:
- https://github.com/asdf-community/asdf-golang/pull/101
i.e. this doesn't feel solved yet, in my mind:
- https://github.com/asdf-community/asdf-golang/issues/99
Also, I think this other issue wouldn't be a bad idea:
- https://github.com/asdf-community/asdf-golang/issues/119
@MPV make sure that line is the top of your .zshrc
I had mine below the asdf init and it wasn't working.
I'm having a similar problem. Placing set ASDF_GOLANG_MOD_VERSION_ENABLED true above source (brew --prefix)/opt/asdf/libexec/asdf.fish in my (fish) shell configs stopped the warning message from appearing on every single prompt, but I continue to get the warning message any time I run go on the command line:
❯ go version
Notice: Behaving like ASDF_GOLANG_MOD_VERSION_ENABLED=true
In the future this will have to be set to continue
reading from the go.mod and go.work files
go version go1.20.13 darwin/arm64
~
❯ echo $ASDF_GOLANG_MOD_VERSION_ENABLED
true
~
❯
Any ideas?
Apologies for the last message, but I think I'll leave it in case someone runs into the same issue. Here's how I resolved it. Note that this only applies to the Fish shell.
Two options:
- Add
set -gx ASDF_GOLANG_MOD_VERSION_ENABLED trueto the top of/Users/crcastle/.config/fish/conf.d/asdf.fish. I mistakenly had left out the-gxwhen I wrote the comment above. - Don't change any config files. Instead run
set -Ux ASDF_GOLANG_MOD_VERSION_ENABLED true. This will save the env var persistently for any new shell (including after a restart).
I like option 1 better because it keeps asdf configuration in one place, the asdf.fish file.