Giter Site home page Giter Site logo

Comments (6)

pgier avatar pgier commented on July 19, 2024 1

Running a go build or just go mod download before linting does appear to fix the issue for me.

from golangci-lint-action.

bombsimon avatar bombsimon commented on July 19, 2024

Have you read Why do you have typecheck errors?

typecheck is not a real linter but golangci-lint's way of presenting compilation/module/run errors.

What happens if you try to compile your code before the linting step with go build ./...?

from golangci-lint-action.

pgier avatar pgier commented on July 19, 2024

Yes, I read the notes about typecheck and followed the instructions there but it didn't help.
I think I've narrowed down the issue. I'm seeing the same issue sometimes with v1.54.2, so it doesn't seem to be related to the 1.55 upgrade. However, in all the failures, it looks like the setup-go action is not finding local cache.

Run actions/setup-go@v4
  with:
    go-version: 1.21
    check-latest: false
    token: ***
    cache: true
Setup go version spec 1.21
Found in cache @ /opt/hostedtoolcache/go/1.21.3/x64
Added go to the path
Successfully set up Go version 1.21
/opt/hostedtoolcache/go/1.21.3/x64/bin/go env GOMODCACHE
/opt/hostedtoolcache/go/1.21.3/x64/bin/go env GOCACHE
/home/runner/go/pkg/mod
/home/runner/.cache/go-build
Cache is not found
go version go1.21.3 linux/amd64

Whereas with the successful runs, setup-go finds the local cache.

/home/runner/.cache/go-build
Received 134217728 of 511766649 (26.2%), 126.9 MBs/sec
Received 335544320 of 511766649 (65.6%), 159.0 MBs/sec
Received 511766649 of 511766649 (100.0%), 164.9 MBs/sec
Cache Size: ~488 MB (511766649 B)
/usr/bin/tar -xf /home/runner/work/_temp/c2939fd8-9587-42a2-81aa-4e1750096bad/cache.tzst -P -C /home/runner/work/bellburnell/bellburnell --use-compress-program unzstd
Cache restored successfully
Cache restored from key: setup-go-Linux-ubuntu22-go-1.21.3-e3e0a5df9b4329f309a1660fef499b27d262892d31bfd97eec3382ce8fa9124b

I didn't think it would be necessary to run a go build before the lint but I can try it.

from golangci-lint-action.

bombsimon avatar bombsimon commented on July 19, 2024

I didn't think it would be necessary to run a go build before the lint but I can try it.

Sorry, I misread parts of your ticket and didn't realize it worked by just retrying. It's so common with these typecheck issues that I didn't read your ticket properly.

go build is not required, I was mostly curious what output it would give since typecheck isn't always the best way to present these issues.

from golangci-lint-action.

ohad83 avatar ohad83 commented on July 19, 2024

I'm having a similar issue.
When running something like this:

jobs:
  golangci:
    name: lint
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-go@v4
        with:
          go-version: "1.21"
          cache: false
      - name: golangci-lint
        uses: golangci/golangci-lint-action@v3
        with:
          version: v1.55.2

I get typecheck failures. When I added a go build before the lint, it worked, and now if I use:


jobs:
  golangci:
    name: lint
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-go@v4
        with:
          go-version: "1.21"

      - run: go mod download

      - name: golangci-lint
        uses: golangci/golangci-lint-action@v3
        with:
          version: v1.55.2
          skip-pkg-cache: true

It works.

@pgier Did you find a different solution?

from golangci-lint-action.

pgier avatar pgier commented on July 19, 2024

@ohad83 looks like you didn't have to run a full go build just a go mod download is that correct?
I didn't find a different solution, I was trying to avoid a full build every time before linting just to reduce the CI feedback loop. I tried changing various caching options without success. It's a bit hard to test because the issue is intermittent for me.

from golangci-lint-action.

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.