Skip to content

golangci-lint-action@v3 ends with Error: The operation was canceled for windows #727

@zak-pawel

Description

@zak-pawel

Welcome

  • Yes, I understand that the GitHub action repository is not the repository of golangci-lint itself.
  • Yes, I've searched similar issues on GitHub and didn't find any.
  • Yes, I've included all information below (version, config, etc).

Description of the problem

I'm trying to enable golangci/golangci-lint-action@v3 action for windows and darwin for https://github.com/influxdata/telegraf repository.

Right now it is run only for linux and it works great. After turning on windows and darwin I got Error: The operation was canceled. without any other explanation (mainly for windows but sometimes also for darwin).

In workflow section you may see two approaches (with 3 OSes and with ubuntu-stable only but with three different values of GOOS). Both of them fails on CI:

2023-04-13T07:34:10.5322928Z ##[group]Run golangci/golangci-lint-action@v3
2023-04-13T07:34:10.5323258Z with:
2023-04-13T07:34:10.5323458Z   version: v1.52.2
2023-04-13T07:34:10.5323708Z   args: --timeout 30m0s --verbose --%nofuture% tab
2023-04-13T07:34:10.5324137Z   github-token: ***
2023-04-13T07:34:10.5324372Z   only-new-issues: false
2023-04-13T07:34:10.5324604Z   skip-cache: false
2023-04-13T07:34:10.5324887Z   skip-pkg-cache: false
2023-04-13T07:34:10.5325255Z   skip-build-cache: false
2023-04-13T07:34:10.5325771Z env:
2023-04-13T07:34:10.5325960Z   nofuture: out-format
2023-04-13T07:34:10.5326170Z ##[endgroup]
2023-04-13T07:34:12.7691635Z ##[group]prepare environment
2023-04-13T07:34:12.7691949Z Checking for go.mod: go.mod
2023-04-13T07:34:12.7692467Z Finding needed golangci-lint version...
2023-04-13T07:34:12.7692813Z Installing golangci-lint v1.52.2...
2023-04-13T07:34:12.7693469Z Downloading https://github.com/golangci/golangci-lint/releases/download/v1.52.2/golangci-lint-1.52.2-windows-amd64.zip ...
2023-04-13T07:34:12.7698820Z Received 6336 of 6336 (100.0%), 0.3 MBs/sec
2023-04-13T07:34:12.7699057Z Cache Size: ~0 MB (6336 B)
2023-04-13T07:34:12.7699696Z [command]"C:\Program Files\Git\usr\bin\tar.exe" -xf D:/a/_temp/91148aab-7fa2-4444-8a2e-5ca46c4a96da/cache.tgz -P -C D:/a/telegraf/telegraf --force-local -z
2023-04-13T07:34:12.7702265Z [command]"C:\Program Files\PowerShell\7\pwsh.exe" -NoLogo -NoProfile -NonInteractive -ExecutionPolicy Unrestricted -Command "$ErrorActionPreference = 'Stop' ; try { Add-Type -AssemblyName System.IO.Compression.ZipFile } catch { } ; try { [System.IO.Compression.ZipFile]::ExtractToDirectory('D:\a\_temp\e1dac7bb-47fd-4ae7-b7b5-e78bec0c8131', 'D:\a\_temp\97359fc8-dc2e-4db3-aca8-34577860d455', $true) } catch { if (($_.Exception.GetType().FullName -eq 'System.Management.Automation.MethodException') -or ($_.Exception.GetType().FullName -eq 'System.Management.Automation.RuntimeException') ){ Expand-Archive -LiteralPath 'D:\a\_temp\e1dac7bb-47fd-4ae7-b7b5-e78bec0c8131' -DestinationPath 'D:\a\_temp\97359fc8-dc2e-4db3-aca8-34577860d455' -Force } else { throw $_ } } ;"
2023-04-13T07:34:12.7703648Z Cache restored successfully
2023-04-13T07:34:12.7704231Z Restored cache for golangci-lint from key 'golangci-lint.cache-2780-db3442852a44702a8dfb5a181d9b5c58dc5e3bd3' in 1285ms
2023-04-13T07:34:12.7705000Z Installed golangci-lint into D:\a\_temp\97359fc8-dc2e-4db3-aca8-34577860d455\golangci-lint-1.52.2-windows-amd64\golangci-lint in 1794ms
2023-04-13T07:34:12.7705427Z Prepared env in 1798ms
2023-04-13T07:34:12.7705818Z ##[endgroup]
2023-04-13T07:34:12.7706207Z ##[group]run golangci-lint
2023-04-13T07:34:12.7706921Z Running [D:\a\_temp\97359fc8-dc2e-4db3-aca8-34577860d455\golangci-lint-1.52.2-windows-amd64\golangci-lint run --out-format=github-actions --timeout 30m0s --verbose --%nofuture% tab] in [] ...
2023-04-13T07:45:13.4587676Z ##[error]The operation was canceled.
2023-04-13T07:45:13.6424825Z Post job cleanup.
2023-04-13T07:45:14.5549949Z Cache hit occurred on the primary key golangci-lint.cache-2780-db3442852a44702a8dfb5a181d9b5c58dc5e3bd3, not saving cache.

I have no problem in running golangci-lint run ... for this repo locally on windows or locally on my ubuntu: GOOS=windows golangci-lint run....

Version of golangci-lint

v1.51.2 and v1.52.2

Version of the GitHub Action

golangci/golangci-lint-action@v3

Workflow file

Canceled for workflow run on different OSes (https://github.com/influxdata/telegraf/actions/runs/4686669975/workflow):

name: golangci-lint
on:
  push:
    branches:
      - master
  pull_request:
    branches:
      - master
  schedule:
    # Trigger every day at 16:00 UTC
    - cron: '0 16 * * *'
permissions:
  contents: read # to fetch code (actions/checkout)
  pull-requests: read # to fetch pull requests (golangci/golangci-lint-action)

jobs:
  golangci:
    name: lint-codebase
    strategy:
      matrix:
        os: [ubuntu-latest, macos-latest, windows-latest]
    runs-on: ${{ matrix.os }}
    timeout-minutes: 30
    steps:
      - name: Checkout code
        uses: actions/checkout@v3
      - name: Setup Go
        uses: actions/setup-go@v3
        with:
          go-version: '1.20'
      - name: golangci-lint standard
        if: runner.os != 'Windows'
        uses: golangci/golangci-lint-action@v3
        with:
          version: v1.51.2
          args: --timeout 30m0s --verbose --out-${NO_FUTURE}format tab
      - name: golangci-lint windows
        if: runner.os == 'Windows'
        uses: golangci/golangci-lint-action@v3
        env:
          nofuture: out-format
        with:
          version: v1.52.2
          args: --timeout 30m0s --verbose --%nofuture% tab

Version for ubuntu-latest only but with different value of GOOS is also cancelled (https://github.com/influxdata/telegraf/actions/runs/4683204161/workflow):

name: golangci-lint
on:
  push:
    branches:
      - master
  pull_request:
    branches:
      - master
  schedule:
    # Trigger every day at 16:00 UTC
    - cron: '0 16 * * *'
permissions:
  contents: read # to fetch code (actions/checkout)
  pull-requests: read # to fetch pull requests (golangci/golangci-lint-action)

jobs:
  golangci:
    name: lint-codebase
    strategy:
      matrix:
        include:
          - GOOS: linux
          - GOOS: windows
          - GOOS: darwin
    runs-on: ubuntu-latest
    steps:
      - uses: actions/setup-go@v3
        with:
          go-version: '1.20'
      - uses: actions/checkout@v3
      - name: golangci-lint
        env:
          GOOS: ${{ matrix.GOOS }}
        uses: golangci/golangci-lint-action@v3
        with:
          version: v1.51.2
          args: --timeout 15m0s --verbose --out-${NO_FUTURE}format tab

Go version

1.20

Code example or link to a public repository

influxdata/telegraf#13037

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions