Coder Social home page Coder Social logo

Comments (7)

HarithaVattikuti avatar HarithaVattikuti commented on July 4, 2024 1

Hello @fmunteanu
Thank you for creating this issue. We will investigate it and get back to you as soon as we have some feedback.

from setup-go.

fmunteanu avatar fmunteanu commented on July 4, 2024

I'm not sure what effect has disabling the cache related to build time, but when I do this, the warning is gone. From my understanding, starting with v4, caching is enabled by default. New step, with cache disabled:

      - name: Setup Go
        uses: actions/setup-go@v5
        with:
          cache: false
          go-version: 1.22.x

Workflow build step has no more warnings:

image

from setup-go.

peterbourgon avatar peterbourgon commented on July 4, 2024

See #478.

from setup-go.

fmunteanu avatar fmunteanu commented on July 4, 2024

Setting the step to (docs reference):

      - name: Setup Go
        uses: actions/setup-go@v5
        with:
          cache: true
          cache-dependency-path: |
            **/go.mod
            **/go.sum

Produces another warning, see Post Setup Go step in workflow:

Post job cleanup.
/opt/hostedtoolcache/go/1.22.2/x64/bin/go env GOMODCACHE
/opt/hostedtoolcache/go/1.22.2/x64/bin/go env GOCACHE
/home/runner/go/pkg/mod
/home/runner/.cache/go-build
Warning: Cache folder path is retrieved but doesn't exist on disk: /home/runner/go/pkg/mod
Cache hit occurred on the primary key setup-go-Linux-ubuntu22-go-1.22.2-2e41450b046298d453631013dd695b7dd7b55d9f5c798193b859fd911bbdba7a, not saving cache.

from setup-go.

tamird avatar tamird commented on July 4, 2024

This also happens in https://github.com/petermattis/goid because that library has no dependencies, and Go doesn't create a go.sum file unless there are at least some dependencies.

It would be good to avoid the warning in such cases.

from setup-go.

KathiravanKrish avatar KathiravanKrish commented on July 4, 2024

Hi @fmunteanu, The below workflow file have resolved the warning message issue. By adding steps to create the mod cache directory and cache the modules, we ensured that the cache folder path exists before it's accessed by the cache action. This eliminates the warning about the cache folder path not existing on the disk.
Going forward, this setup should provide a smoother run for your Go workflows. If you encounter any more issues or have other questions, don't hesitate to ask.

- name: Check out code into the Go module directory
    uses: actions/checkout@v4

  - name: Set up Go
    uses: actions/setup-go@v5
    with:
      go-version: 1.22.x
      cache: true

  - name: Create mod cache directory
    run: mkdir -p /home/runner/go/pkg/mod

  - name: Cache modules
    uses: actions/cache@v2
    with:
      path: /home/runner/go/pkg/mod
      key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
      restore-keys: |
        ${{ runner.os }}-go-
  - name: Build
    run: go build -v ./...

  - name: Test
    run: go test -v ./...

from setup-go.

KathiravanKrish avatar KathiravanKrish commented on July 4, 2024

Hello @fmunteanu
Just a gentle reminder!

from setup-go.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.