mirror of https://github.com/actions/setup-go
Compare commits
9 Commits
26d621e01d
...
f7b829f4ff
Author | SHA1 | Date |
---|---|---|
Victor Martinez | f7b829f4ff | |
Andy Brody | 99176a8f9a | |
Victor Martinez | b544d3a2e3 | |
Victor Martinez | 0fc6876467 | |
Victor Martinez | 721bdf3e4e | |
Victor Martinez | fde5dd24bd | |
Victor Martinez | 4878e37175 | |
Victor Martinez | ef084a2719 | |
Victor Martinez | ad27ba4c6d |
55
README.md
55
README.md
|
@ -8,6 +8,14 @@ This action sets up a go environment for use in actions by:
|
|||
- Optionally downloading and caching a version of Go by version and adding to `PATH`.
|
||||
- Registering problem matchers for error output.
|
||||
|
||||
# V5
|
||||
|
||||
The V5 edition of the action offers:
|
||||
|
||||
- Upgraded Node.js runtime from node16 to node20
|
||||
|
||||
See full release notes on the [releases page](https://github.com/actions/setup-go/releases).
|
||||
|
||||
# V4
|
||||
|
||||
The V4 edition of the action offers:
|
||||
|
@ -179,16 +187,19 @@ steps:
|
|||
|
||||
- run: go run hello.go
|
||||
```
|
||||
|
||||
## Getting go version from the go.mod file
|
||||
|
||||
The `go-version-file` input accepts a path to a `go.mod` file or a `go.work` file that contains the version of Go to be
|
||||
used by a project. As the `go.mod` file contains only major and minor (e.g. 1.18) tags, the action will search for the
|
||||
latest available patch version sequentially in the runner's directory with the cached tools, in
|
||||
the [versions-manifest.json](https://github.com/actions/go-versions/blob/main/versions-manifest.json) file or at the go
|
||||
servers.
|
||||
## Getting go version from a file
|
||||
|
||||
If both the `go-version` and the `go-version-file` inputs are provided then the `go-version` input is used.
|
||||
|
||||
If the file contains only major and minor (e.g. 1.18) tags, the action will search for the latest available patch version
|
||||
sequentially in the runner's directory with the cached tools, in the [version-manifest.json](https://github.com/actions/go-versions/blob/main/versions-manifest.json)
|
||||
file or at the go servers.
|
||||
|
||||
### If the go.mod or .tool-versions files
|
||||
|
||||
The `go-version-file` input accepts a path to a `go.mod` file, [.tool-versions](https://asdf-vm.com/manage/configuration.html#tool-versions) file or a `go.work` file that contains the version of Go to be used by a project.
|
||||
As the `go.mod` file contains only major and minor (e.g. 1.18) tags, the action will follow the above-mentioned approach.
|
||||
|
||||
> The action will search for the `go.mod` file relative to the repository root
|
||||
|
||||
```yaml
|
||||
|
@ -200,6 +211,34 @@ steps:
|
|||
- run: go version
|
||||
```
|
||||
|
||||
The `go-version` output contains the resolved Golang version from the `go.mod` file.
|
||||
|
||||
> The action will search for the `.tool-versions` file relative to the repository root
|
||||
|
||||
```yaml
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/setup-go@v4
|
||||
with:
|
||||
go-version-file: '.tool-versions'
|
||||
- run: go version
|
||||
```
|
||||
|
||||
### If a different file
|
||||
|
||||
The `go-version-file` input accepts a path to a file that contains the version of Go to be used by a project. It supports either major and minor (e.g 1.18) or major, minor and patch (e.g 1.18.7) tags. If the file contains only major and minor (e.g. 1.18) tags, the action will follow the above-mentioned approach.
|
||||
|
||||
> The action will search for the `.go-version` file relative to the repository root
|
||||
|
||||
```yaml
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/setup-go@v3
|
||||
with:
|
||||
go-version-file: 'path/to/.go-version'
|
||||
- run: go version
|
||||
```
|
||||
|
||||
## Matrix testing
|
||||
|
||||
```yaml
|
||||
|
|
Loading…
Reference in New Issue