Closed rliebz closed 1 year ago
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 asdf
around legacy versions came much later. At this point I'm hesitant to break the current behavior outright, but perhaps we can deprecate it over time.
What do you think about a hybrid approach. If the user has neither ASDF_GOLANG_MOD_VERSION_{ENABLED,DISABLED}
set, we continue the current behavior, but emit a warning to stderr that in the future users will need to set one or the other. Then in the future we move to requiring ASDF_GOLANG_MOD_VERSION_ENABLED
?
@rliebz thoughts on #101?
Yeah that seems like a great compromise between backward compatibility for now and asdf
standardization long-term. Thanks for taking the time to respond and put that change together.
👍 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 false
... probably when it comes up again. :wink:
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: https://github.com/golang/go/discussions/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.