Add support for ASDF_GOLANG_MOD_VERSION (#101)

* Emmit warning and change behavior based on ASDF_GOLANG_MOD_VERSION

* Add note on ASDF_GOLANG_MOD_VERSION to README.

* Rename to ASDF_GOLANG_MOD_VERSION_ENABLED.
This commit is contained in:
Kenny Parnell 2023-05-11 14:37:45 -04:00 committed by GitHub
parent b0a0ee7d85
commit 3c3674a10c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 20 additions and 1 deletions

View File

@ -61,6 +61,10 @@ version with a matching major version. For example, a `go 1.14` directive in a
`go.mod` file will result in the highest installed `1.minor.patch` being
selected, not necessarily `1.14.patch`.
**Note**: Users can explicitly exclude or include `go.mod` and `go.work` by
setting `ASDF_GOLANG_MOD_VERSION_ENABLED`. Currently it defaults to `true`, but that
may change in the future, so it should be explicitly set.
## Architecture Override
The `ASDF_GOLANG_OVERWRITE_ARCH` variable can be used to override the architecture

View File

@ -1,3 +1,18 @@
#!/usr/bin/env bash
echo ".go-version go.mod go.work"
case "${ASDF_GOLANG_MOD_VERSION_ENABLED:-}" in
true)
printf ".go-version go.mod go.work\n"
;;
false)
printf ".go-version\n"
;;
*)
cat >&2 <<-EOF
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
EOF
printf ".go-version go.mod go.work\n"
;;
esac