mirror of
https://github.com/actions/setup-go.git
synced 2026-04-11 07:00:04 +00:00
fix: parse go-version-file by content
The `parseGoVersionFile` function used to only
check for exact filenames like "go.{mod,work}".
When `go-version-file` pointed to something like a
tools modfile ("go.tool.mod"), it would just dump
the whole file contents back, which then got
mistaken for a version spec and broke the
manifest/dist resolution.
Now it looks at the file content to spot Go module
or workspace files and pulls out the `toolchain`
or `go` directives. Left ".tool-versions" handling
alone.
Fixes #746
Signed-off-by: Dwi Siswanto <git@dw1.io>
This commit is contained in:
parent
4a3601121d
commit
493769a1ce
4 changed files with 61 additions and 21 deletions
|
|
@ -164,7 +164,7 @@ jobs:
|
|||
|
||||
## Using the `go-version-file` input
|
||||
|
||||
`setup-go` action can read the Go version from a version file. `go-version-file` input is used for specifying the path to the version file. If the file supplied to the `go-version-file` input doesn't exist, the action will fail with an error. This input supports go.mod, go.work, .go-version, and .tool-versions files.
|
||||
`setup-go` action can read the Go version from a version file. `go-version-file` input is used for specifying the path to the version file. If the file supplied to the `go-version-file` input doesn't exist, the action will fail with an error. This input supports standard `go.mod` and `go.work` files, custom files that use the same `go.mod`/`go.work` format (for example, `go.tool.mod`), and `.go-version` and `.tool-versions` files.
|
||||
|
||||
If both the `go-version` and the `go-version-file` inputs are provided then the `go-version` input is used. The `.tool-versions` file supports version specifications in accordance with asdf standards, adhering to Semantic Versioning ([semver](https://semver.org)).
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue