[2023-03-30]: Setup-go Action now enabled with caching by default - [GA] #9131 (#35001)

Co-authored-by: Lucas Costi <lucascosti@users.noreply.github.com>
This commit is contained in:
Anne-Marie 2023-03-23 09:36:41 +01:00 коммит произвёл GitHub
Родитель d966f6c324
Коммит 992bd4e0de
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
3 изменённых файлов: 24 добавлений и 2 удалений

Просмотреть файл

@ -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 %}