asdf-golang icon indicating copy to clipboard operation
asdf-golang copied to clipboard

Not able to disable `ASDF_GOLANG_MOD_VERSION_ENABLED`

Open MPV opened this issue 2 years ago • 3 comments

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:

  1. Add export ASDF_GOLANG_MOD_VERSION_ENABLED=false in the shell's configs (.zshrc/equivalent).
  2. 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 avatar Sep 11 '23 10:09 MPV

@MPV make sure that line is the top of your .zshrc

I had mine below the asdf init and it wasn't working.

zackerydev avatar Jan 14 '24 19:01 zackerydev

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?

crcastle avatar Jan 30 '24 22:01 crcastle

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:

  1. Add set -gx ASDF_GOLANG_MOD_VERSION_ENABLED true to the top of /Users/crcastle/.config/fish/conf.d/asdf.fish. I mistakenly had left out the -gx when I wrote the comment above.
  2. 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.

crcastle avatar Jan 30 '24 22:01 crcastle