зеркало из https://github.com/github/docs.git
Co-authored-by: Lucas Costi <lucascosti@users.noreply.github.com>
This commit is contained in:
Родитель
d966f6c324
Коммит
992bd4e0de
|
@ -128,7 +128,21 @@ You can use `go get` to install dependencies:
|
|||
|
||||
### Caching dependencies
|
||||
|
||||
You can cache and restore the dependencies using the [`setup-go` action](https://github.com/actions/setup-go). By default, caching is disabled, but you can set the `cache` parameter to `true` to enable it.
|
||||
You can cache and restore dependencies using the [`setup-go` action](https://github.com/actions/setup-go). By default, caching is {% ifversion actions-setup-go-default-cache-enabled %}enabled when using the `setup-go` action.{% else %}disabled, but you can set the `cache` parameter to `true` to enable it.{% endif %}
|
||||
|
||||
{% ifversion actions-setup-go-default-cache-enabled %}
|
||||
The `setup-go` action searches for the dependency file, `go.sum`, in the repository root and uses the hash of the dependency file as a part of the cache key.
|
||||
|
||||
You can use the `cache-dependency-path` parameter for cases when multiple dependency files are used, or when they are located in different subdirectories.
|
||||
|
||||
```yaml{:copy}
|
||||
- name: Setup Go
|
||||
- uses: {% data reusables.actions.action-setup-go %}
|
||||
with:
|
||||
go-version: '1.17'
|
||||
cache-dependency-path: subdir/go.sum
|
||||
```
|
||||
{% else %}
|
||||
|
||||
When caching is enabled, the `setup-go` action searches for the dependency file, `go.sum`, in the repository root and uses the hash of the dependency file as a part of the cache key.
|
||||
|
||||
|
@ -149,6 +163,7 @@ Alternatively, you can use the `cache-dependency-path` parameter for cases when
|
|||
cache: true
|
||||
cache-dependency-path: subdir/go.sum
|
||||
```
|
||||
{% endif %}
|
||||
|
||||
If you have a custom requirement or need finer controls for caching, you can use the [`cache` action](https://github.com/marketplace/actions/cache). For more information, see "[AUTOTITLE](/actions/using-workflows/caching-dependencies-to-speed-up-workflows)."
|
||||
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
# Reference: #9131
|
||||
# Setup-Go Action now enabled with caching by default
|
||||
versions:
|
||||
fpt: '*'
|
||||
ghec: '*'
|
||||
ghes: '>=3.9'
|
||||
ghae: '>=3.9'
|
|
@ -1 +1 @@
|
|||
actions/setup-go@{% ifversion actions-node16-action %}v3{% else %}v2{% endif %}
|
||||
actions/setup-go@{% ifversion actions-setup-go-default-cache-enabled %}v4{% elsif actions-node16-action %}v3{% else %}v2{% endif %}
|
||||
|
|
Загрузка…
Ссылка в новой задаче