-
-
Notifications
You must be signed in to change notification settings - Fork 93
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
go.mod is not an asdf-compatible version file #99
Comments
If I were doing it all over again, I probably would go with option 1 and not include the behavior to begin with, but the guidance from What do you think about a hybrid approach. If the user has neither |
Yeah that seems like a great compromise between backward compatibility for now and 👍 from me! |
I'm going to go ahead and mark this as closed for now as folks can opt in/out after merging #101. I'll formulate a timeline for switching the default to |
ASDF_GOLANG_MOD_VERSION_ENABLED - see asdf-community/asdf-golang#99 Temporarily pin a version of node (not lts) until 'node-build: definition not found: 18' error resolved
I might be wrong, but I'm not sure if the changes in #101 worked as intended (i.e. can't be disabled), see this issue: |
Describe the bug
The go directive in the
go.mod
file does not indicate the Go executable version that should be used to build the project. In particular, thego
tool explicitly works with versions other than the version in thego
directive. Much of the language in the Go module reference suggests this to be the case:More evidence that the
go
directive is not prescriptive about the specific Go version that it should be built with is evidenced by a discussion about the possibility of incorporating a toolchain version into thego.mod
file andgo
tool, independently from the existing directive: golang/go#55092Additionally, this plugin's treatment of
go.mod
version selection explicitly conflicts with the rules provided byasdf
:This explicitly violates that spec rule by looking at the installed versions, and having no deterministic version resolution (e.g., what version should be used if
go 1.20
is specified).Because
asdf
does not allow enabling/disabling of specific legacy file formats on a per-tool basis, it is not possible to opt into the standardasdf
treatment of legacy files without also opting into this plugin's non-standard interpretation ofgo.mod
and theasdf
functionality.To Reproduce
legacy_version_file = yes
go
withasdf global golang system
(or other)go.mod
file and no.tool-versions
asdf
/golang
version is not respected, becausego.mod
is incorrectly treated as a version fileExpected behavior
The global
golang
version will be chosenActual behavior
The go version is chosen non-deterministically based on the local
go.mod
fileAdditional context
Broadly speaking, there are three ways to address this:
go.mod
andasdf
spec interpretationexport ASDF_GOLANG_MOD_VERSION=true
)export ASDF_GOLANG_MOD_VERSION_DISABLED=true
). I would personally not recommend this, because it requires configuration to prevent non-standard behaviorI'm happy to make the contribution, but I wanted to get buy in before starting work.
The text was updated successfully, but these errors were encountered: