-
Notifications
You must be signed in to change notification settings - Fork 795
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: Can not get a list of installed versions from a plugin. #1372
Comments
@kennyp sorry for the late reply here. Does this affect any other plugins? If not I suspect the golang plugin is doing something odd. |
As a general rule plugins should not invoke asdf, otherwise you may create cyclic dependency that results in infinite recursion. I suspect The line I am referring to is https://github.com/kennyp/asdf-golang/blob/master/bin/parse-legacy-file#L19. It should be possible to refactor the callback so that line isn't necessary. |
@Stratus3D that all makes sense, but given how the legacy file is supposed to be interpreted, how do you recommend I get a list of installed versions without using using |
Am I correct in summarizing the process as this?
|
@Stratus3D close. We really only care about the major version. So we return the latest installed version that matches. |
@Stratus3D fixed the issue in asdf-golang/93 by taking some inspiration from |
Looking at the docs I see we don't document this, but the Remember, there are different golang versions because there are different revisions of the code, and those revisions were made to change golang behavior. So if those users end up using two different versions, there is always the chance they will observe different behavior, and that's something we want to avoid with asdf. See #1012 for a related discussion. I know this probably isn't what you want, but I do think this is the right choice for asdf core. You have a couple options:
I will propose an update to the docs. |
@jthegedus what do you think about me changing this:
To this:
|
@Stratus3D That change makes sense. As someone who works with Go, I am often confused by this practice of using major versions only. Minor and patch versions exist because they're different, so shouldn't be ignored by teams writing Go or else will introduce inconsistencies. I have given up on this "crusade" at my workplace. |
Describe the Bug
An issue posted on the golang plugin brought to my attention that head breaks the plugin if
legacy_version_file
is enabled. Because of the semantics of how thego.mod
file is supposed to be interpreted,parse-legacy-file
depends on the ability to get a list of the currently installed versions. What is a safe way to get a list of installed versions without calling back intoasdf list
and breaking things?Steps to Reproduce
asdf update --head
echo 'legacy_version_file = yes' >> ~/.asdfrc
asdf plugin-install golang
mkdir example; cd example; go mod init example.com/m
asdf list golang
Expected Behaviour
Nothing hangs.
Actual Behaviour
Infinite recursion resulting in hanging and possible crashing of the shell/terminal.
Environment
The text was updated successfully, but these errors were encountered: