mirror of
https://github.com/actions/setup-go.git
synced 2025-04-23 17:40:50 +00:00
Change documentation according to changes brought by feature
This commit is contained in:
parent
2968ddac8d
commit
b427445125
2 changed files with 33 additions and 1 deletions
32
README.md
32
README.md
|
@ -17,6 +17,7 @@ The V3 offers:
|
||||||
- Adds GOBIN to the PATH
|
- Adds GOBIN to the PATH
|
||||||
- Proxy Support
|
- Proxy Support
|
||||||
- Check latest version
|
- Check latest version
|
||||||
|
- Caching packages dependencies
|
||||||
- Bug Fixes (including issues around version matching and semver)
|
- Bug Fixes (including issues around version matching and semver)
|
||||||
|
|
||||||
The action will first check the local cache for a version match. If a version is not found locally, it will pull it from the `main` branch of the [go-versions](https://github.com/actions/go-versions/blob/main/versions-manifest.json) repository. On miss or failure, it will fall back to downloading directly from [go dist](https://storage.googleapis.com/golang). To change the default behavior, please use the [check-latest input](#check-latest-version).
|
The action will first check the local cache for a version match. If a version is not found locally, it will pull it from the `main` branch of the [go-versions](https://github.com/actions/go-versions/blob/main/versions-manifest.json) repository. On miss or failure, it will fall back to downloading directly from [go dist](https://storage.googleapis.com/golang). To change the default behavior, please use the [check-latest input](#check-latest-version).
|
||||||
|
@ -92,6 +93,37 @@ steps:
|
||||||
- run: go run hello.go
|
- run: go run hello.go
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Caching packages dependencies:
|
||||||
|
|
||||||
|
The action has a built-in functionality for caching and restoring dependencies. It uses [actions/cache](https://github.com/actions/cache) under the hood for caching dependencies but requires less configuration settings.The `cache` input is optional, and caching is turned off by default.
|
||||||
|
|
||||||
|
The action defaults to search for the dependency file - go.sum in the repository root, and uses its hash as a part of the cache key. Use `cache-dependency-path` input for cases when multiple dependency files are used, or they are located in different subdirectories.
|
||||||
|
|
||||||
|
**Caching packages dependencies without specifying dependency file path**
|
||||||
|
```yaml
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
- uses: actions/setup-go@v3
|
||||||
|
with:
|
||||||
|
go-version: '1.14'
|
||||||
|
check-latest: true
|
||||||
|
cache: true
|
||||||
|
- run: go run hello.go
|
||||||
|
```
|
||||||
|
|
||||||
|
**Caching packages dependencies in monorepos**
|
||||||
|
```yaml
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
- uses: actions/setup-go@v3
|
||||||
|
with:
|
||||||
|
go-version: '1.14'
|
||||||
|
check-latest: true
|
||||||
|
cache: true
|
||||||
|
cache-dependency-path: subdir/go.sum
|
||||||
|
- run: go run hello.go
|
||||||
|
```
|
||||||
|
|
||||||
## Matrix Testing:
|
## Matrix Testing:
|
||||||
```yaml
|
```yaml
|
||||||
jobs:
|
jobs:
|
||||||
|
|
|
@ -13,7 +13,7 @@ inputs:
|
||||||
cache:
|
cache:
|
||||||
description: Used to specify whether go-modules caching is needed. Set to true, if you'd like to enable caching.
|
description: Used to specify whether go-modules caching is needed. Set to true, if you'd like to enable caching.
|
||||||
cache-dependency-path:
|
cache-dependency-path:
|
||||||
description: 'Used to specify the path to a dependency file: go.sum'
|
description: 'Used to specify the path to a dependency file - go.sum'
|
||||||
runs:
|
runs:
|
||||||
using: 'node16'
|
using: 'node16'
|
||||||
main: 'dist/setup/index.js'
|
main: 'dist/setup/index.js'
|
||||||
|
|
Loading…
Add table
Reference in a new issue