Caching go on Mac OS build environment?

Has anyone installed go on Mac OS build environment and then saved it to cache for future builds and restoring from cache at the start thereafter?

I attempted to do so along with caching for Android tooling being installed on Mac OS environment (Android SDK, NDK, platform tools).

So far the Android stuff seems to cache ok, but not go, that didn’t seem to properly persist to cache even though the save cache step ran and the go install was successful. On restore cache, the saved paths weren’t found for some reason.

The job config is like:

job_name:
  <<: *defaults
  macos:
  xcode: 11.3.0
  - restore_cache:
      keys:
        - go-deps-v1
  - run:
      name: cache check for go stuff & install/setup if not cached
      command: |
        brew --version # just to check that brews installed, for debugging reference
        [ ! -d /usr/local/opt/go@1.13 ] && brew update && brew install go@1.13 && echo "done installing go"
        echo 'export GOPATH="$HOME/go"' >> $BASH_ENV
        echo 'export PATH="/usr/local/opt/go@1.13/bin:$GOPATH/bin:$PATH"' >> $BASH_ENV
        source $BASH_ENV
        go version
  - save_cache:
      key: go-deps-v1
      paths:
        - /usr/local/opt/go@1.13
        - /usr/local/opt/go@1.13/bin
        - ~/go
        - ~/go/bin

Could you try using the absolute path (i.e. /Users/distiller/go/bin). I can’t seem to find it in the docs, but I can remember that there are some parts of the config that do not know how to handle relative paths.

Thanks, I’ll give that a try next time.