Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: asdf global golang latest doesn't work #1785

Open
scarf005 opened this issue Oct 1, 2024 · 1 comment
Open

bug: asdf global golang latest doesn't work #1785

scarf005 opened this issue Oct 1, 2024 · 1 comment
Labels

Comments

@scarf005
Copy link

scarf005 commented Oct 1, 2024

Describe the Bug

I'm unable to make golang plugin to work despite installing it and reshimming.
similar to #914, but reshim doesn't work at all.

Steps to Reproduce

$ asdf plugin-add golang
Plugin named golang already added
$ asdf install golang latest
golang 1.23.1 is already installed
$ asdf global golang latest
$ asdf reshim golang
$ asdf reshim
$ cat ~/.tool-versions 
dprint 0.47.2
golang 1.23.1
$  fd --hidden .tool-versions
.tool-versions
repo/etc/obs_script/.tool-versions
repo/etc/stackflow/.tool-versions
repo/etc/one-time-contribution/ts-rest-hono/.tool-versions
repo/etc/ultraytics/.tool-versions
$ asdf current
direnv          2.32.3          Not installed. Run "asdf install direnv 2.32.3"
golang          1.21.6          Not installed. Run "asdf install golang 1.21.6"
python          3.12.4          Not installed. Run "asdf install python 3.12.4" 

Expected Behaviour

  • installing plugin works.
  • ~/.tool-versions (go 1.23.6) is respected.

Actual Behaviour

$ go
No preset version installed for command go
Please install a version by running one of the following:

asdf install golang 1.21.6

or add one of the following versions in your config file at /run/media/home/scarf/.tool-versions
golang 1.23.1

it attempts to read golang 1.21.6 despite global configured to load 1.23.6.

Environment

OS:
Linux fedora 6.10.8-200.fc40.x86_64 #1 SMP PREEMPT_DYNAMIC Wed Sep  4 21:41:11 UTC 2024 x86_64 GNU/Linux

SHELL:
GNU bash, 버전 5.2.26(1)-release (x86_64-redhat-linux-gnu)
Copyright (C) 2022 Free Software Foundation, Inc.
라이선스 GPLv3+: GNU GPL 버전 3 이상 <http://gnu.org/license/gpl.html>

이 프로그램은 자유 소프트웨어입니다. 자유롭게 바꾸고 재배포할 수 있습니다.
법률이 허용하는 모든 범위내의 보증은 없습니다.

BASH VERSION:
5.2.26(1)-release

ASDF VERSION:
v0.14.1-f00f759

ASDF INTERNAL VARIABLES:
ASDF_DEFAULT_TOOL_VERSIONS_FILENAME=.tool-versions
ASDF_DATA_DIR=/home/scarf/.local/share/asdf
ASDF_DIR=/home/scarf/.config/asdf
ASDF_CONFIG_FILE=/home/scarf/.asdfrc

ASDF INSTALLED PLUGINS:
direnv                       https://github.com/asdf-community/asdf-direnv.git master 6ff3dbe
golang                       https://github.com/asdf-community/asdf-golang.git master d4f1d65
python                       https://github.com/danhper/asdf-python.git master 7b0af87

asdf plugins affected (if relevant)

golang

@scarf005 scarf005 added the bug label Oct 1, 2024
@jthegedus
Copy link
Contributor

It seems, when you ran the go command in your "Actual Behaviour" section, you were in a directory under /run/media/home/scarf as your error shows add one of the following versions in your config file at /run/media/home/scarf/.tool-versions. Emphasis on the directory.

The version suggested to be installed also matches what your asdf current output shows.

It is hard to tell as your reproduction does not include your current working directory where all these commands were executed.

So I would guess, the directory you were in was resolving to the /run/media/home/scarf/.tool-verisons file, which had golang 1.21.6 in it, but that version was not installed.

It will not "fallback" to the "global" version if there is a specific version defined in a closer .tool-version file for your current working directory.

Eg:

+ /run/media/home
+-- .tool-verions       << has golang 1.23.1
+-- /scarf
    +-- .tool-verisons  << has golang 1.21.6
    +-- /some
        +-- /other
            +-- /dir    << current working directory

asdf just walks up to the root directory from the current working directory, with definitions closer to the current working directory taking precedence.

So it would use 1.21.6 as it is the closest version definition for golang.

Are you able to re-test with this information, or try a reproduction where you show any directories and cds? Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants