GitHub golangci-lint 操作失败,无法加载 fmt

GitHub action for golangci-lint fails with can't load fmt

我正在使用 GitHub 操作 https://github.com/golangci/golangci-lint-action

我遇到错误:

Installed golangci-lint into /home/runner/golangci-lint-1.43.0-linux-amd64/golangci-lint in 458ms
Prepared env in 606ms

run golangci-lint
  Running [/home/runner/golangci-lint-1.43.0-linux-amd64/golangci-lint run --out-format=github-actions] in [] ...
  panic: load embedded ruleguard rules: rules/rules.go:13: can't load fmt
  
  goroutine 1 [running]:
  github.com/go-critic/go-critic/checkers.init.9()
    github.com/go-critic/go-critic@v0.6.1/checkers/checkers.go:58 +0x4b4
  
  Error: golangci-lint exit with code 2
  Ran golangci-lint in 13383ms

这是 golangci-lint 与 golang v1.18.0 https://github.com/golangci/golangci-lint/issues/2374

的已知问题

我的 GitHub 动作文件是:

name: golangci-lint
on:
  push:
    tags:
      - v*
    branches:
      - master
      - main
  pull_request:
permissions:
  contents: read
jobs:
  golangci:
    name: lint
    runs-on: ubuntu-latest
    steps:
      - uses: actions/setup-go@v2
      - uses: actions/checkout@v2
      - name: golangci-lint
        uses: golangci/golangci-lint-action@v2
        with:
          version: v1.43

我也试过使用:

name: golangci-lint
on:
  push:
    tags:
      - v*
    branches:
      - master
      - main
  pull_request:
permissions:
  contents: read
jobs:
  golangci:
    strategy:
      matrix:
        go-version: [1.17.x]
    name: lint
    runs-on: ubuntu-latest
    steps:
      - uses: actions/setup-go@v3
        with:
          go-version: ${{ matrix.go }}
      - uses: actions/checkout@v3
      - name: golangci-lint
        uses: golangci/golangci-lint-action@v2
        with:
          version: v1.43

但是两者都失败了,在这种情况下我该怎么办?

我已经在项目中打开这个问题,以防有帮助https://github.com/golangci/golangci-lint-action/issues/442

将 golangci/golangci-lint-action、actions/setup-go 和 actions/checkout 升级到 v3 对我有用。