mirror of
https://github.com/actions/setup-go.git
synced 2025-04-23 17:40:50 +00:00
Merge pull request #1 from IvanZosimov/go-version-from-file
Change README.md file
This commit is contained in:
commit
fab50db5d2
1 changed files with 15 additions and 16 deletions
31
README.md
31
README.md
|
@ -94,6 +94,21 @@ steps:
|
||||||
check-latest: true
|
check-latest: true
|
||||||
- run: go run hello.go
|
- 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 containing 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 [version-manifest.json](https://github.com/actions/go-versions/blob/main/versions-manifest.json) file or at the go servers.
|
||||||
|
|
||||||
|
If both the `go-version` and the `go-version-file` inputs are provided then the `go-version` input is used.
|
||||||
|
> The action will search for the `go.mod` file relative to the repository root
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
- uses: actions/setup-go@v3
|
||||||
|
with:
|
||||||
|
go-version-file: 'path/to/go.mod'
|
||||||
|
- run: go version
|
||||||
|
```
|
||||||
|
|
||||||
## Matrix testing
|
## Matrix testing
|
||||||
|
|
||||||
|
@ -123,22 +138,6 @@ The `go-version` input supports the following syntax:
|
||||||
|
|
||||||
For more information about semantic versioning, please refer to [semver](https://github.com/npm/node-semver) documentation.
|
For more information about semantic versioning, please refer to [semver](https://github.com/npm/node-semver) documentation.
|
||||||
|
|
||||||
## Getting go version from the go.mod file
|
|
||||||
|
|
||||||
The `go-version-file` input accepts a path to a `go.mod` file containing 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 [version-manifest.json](https://github.com/actions/go-versions/blob/main/versions-manifest.json) file or at the go servers.
|
|
||||||
|
|
||||||
If both the `go-version` and the `go-version-file` inputs are provided then the `go-version` input is used.
|
|
||||||
> The action will search for the `go.mod` file relative to the repository root
|
|
||||||
|
|
||||||
```yaml
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v3
|
|
||||||
- uses: actions/setup-go@v3
|
|
||||||
with:
|
|
||||||
go-version-file: '**/go.mod'
|
|
||||||
- run: go version
|
|
||||||
```
|
|
||||||
|
|
||||||
# License
|
# License
|
||||||
|
|
||||||
The scripts and documentation in this project are released under the [MIT License](LICENSE)
|
The scripts and documentation in this project are released under the [MIT License](LICENSE)
|
||||||
|
|
Loading…
Add table
Reference in a new issue