cache
cache copied to clipboard
A better golang cache recipe for ASDF users
name: Setup Golang
description: provisions tooling and installs dependancies
runs:
using: "composite"
steps:
- name: Get GO cache directory path
id: go-cache-dir-path
run: echo "::set-output name=dir::$(go env GOCACHE)"
shell: bash
- uses: actions/cache@v3
id: go-cache
with:
path: ${{ steps.go-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Install go deps
shell: bash
run: go mod download
if: steps.go-cache.outputs.cache-hit != 'true'
@airtonix do you want to create a PR by updating this in the readme docs so that we can have more eyes on this?
Closed due to no reply. Feel free to reopen this issue if you feel this needs to be addressed. I tried a sample workflow with normal golang code but didn't get any success with it, requesting you to please share a sample workflow where this recipe works across OSes. Thanks!