Skip to content

Difference between golangci-lint-action@v2 golangci-lint-action@v3 "can't run linter goanalysis_metalinter: buildssa: failed to load package {{package}}: could not load export data: no export data for {{path}}" #715

@pascal-blokur

Description

@pascal-blokur

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've migrated golangci-lint-action from v2 to v3 and I have the following error raised:

can't run linter goanalysis_metalinter: buildssa: failed to load package {{package}}: could not load export data: no export data for {{path}}

I've rolled back to golangci-lint-actions v2, and the error is no longer raised.

I've checked the golangci-lint repository for similar issues, most of them indicate this happens when the code doesn't compile - which isn't my case.

Here are the traces of the execution :

Run golangci/golangci-lint-action@v3
  with:
    args: --verbose --timeout 5m0s
    github-token: ***
    only-new-issues: false
    skip-cache: false
    skip-pkg-cache: false
    skip-build-cache: false
prepare environment
  Checking for go.mod: go.mod
  Finding needed golangci-lint version...
  Requested golangci-lint 'latest', using 'v1.5[2]({{myrepo}}6#step:6:2).2', calculation took 66ms
  Installing golangci-lint v1.52.2...
  Downloading https://github.com/golangci/golangci-lint/releases/download/v1.52.2/golangci-lint-1.52.2-linux-amd64.tar.gz ...
  /usr/bin/tar xz --overwrite --warning=no-unknown-keyword --overwrite -C /home/runner -f /home/runner/work/_temp/XXX[3]({{myrepo}}#step:6:3)831
  Installed golangci-lint into /home/runner/golangci-lint-1.52.2-linux-amd6[4]({{myrepo}}#step:6:4)/golangci-lint in 691ms
  Received 79691776 of 198074692 (40.2%), 7[5]({{myrepo}}#step:6:5).9 MBs/sec
  Received 198074[6]({{myrepo}}#step:6:6)92 of 1980[7]({{myrepo}}#step:6:7)4692 (100.0%), 112.4 MBs/sec
  Cache Size: ~1[8]({{myrepo}}#step:6:8)[9]({{myrepo}}#step:6:9) MB (198074692 B)
  /usr/bin/tar -xf /home/runner/work/_temp/XXX/cache.tgz -P -C /home/runner/work/bk-{{myrepo}}/{{myrepo}} -z
  Cache restored successfully
  Restored cache for golangci-lint from key 'golangci-lint.cache-XXX' in 5174ms
  Prepared env in 5175ms
run golangci-lint
  Running [/home/runner/golangci-lint-1.52.2-linux-amd64/golangci-lint run --out-format=github-actions --verbose --timeout 5m0s] in [] ...
  level=info msg="[config_reader] Config search paths: [./ /home/runner/work/{{repo}}/{{repo}} /home/runner/work/{{repo}} /home/runner/work /home/runner /home /]"
  level=info msg="[config_reader] Used config file .golangci.yml"
  level=info msg="[lintersdb] Active 72 linters: [asciicheck bidichk bodyclose containedctx contextcheck cyclop decorder depguard dogsled dupl durationcheck errcheck errchkjson errname errorlint exhaustive exportloopref forbidigo forcetypeassert funlen gocognit goconst gocritic gocyclo godot godox gofmt gofumpt goheader goimports gomnd gomoddirectives gomodguard goprintffuncname gosec gosimple govet grouper importas ineffassign ireturn lll maintidx makezero misspell nakedret nestif nilerr nilnil nlreturn noctx nolintlint prealloc predeclared promlinter revive rowserrcheck sqlclosecheck staticcheck stylecheck tagliatelle tenv thelper tparallel typecheck unconvert unparam unused varnamelen wastedassign whitespace wrapcheck]"
  level=info msg="[loader] Using build tags: [integration]"
  level=info msg="[loader] Go packages loading at mode 575 (exports_file|files|name|compiled_files|deps|imports|types_sizes) took 6.03291[10]({{myrepo}}#step:6:10)38s"
  level=info msg="[runner/filename_unadjuster] Pre-built 0 adjustments in 6.752961ms"
  level=info msg="[linters_context] importas settings found, but no aliases listed. List aliases under alias: key."
  level=info msg="[linters_context/goanalysis] analyzers took 15.79647082s with top 10 stages: gocritic: 8.925981024s, the_only_name: 2.9[13]({{myrepo}}#step:6:13)226788s, dupl: 798.286367ms, unconvert: 772.022689ms, wastedassign: 547.851857ms, buildir: 364.582516ms, buildssa: 290.498807ms, gofmt: 198.474623ms, bidichk: 150.465897ms, goimports: 103.822805ms"
  level=warning msg="[runner] Can't run linter goanalysis_metalinter: buildssa: failed to load package {{package_name}}: could not load export data: no export data for \"{{package_path}}\""
  level=info msg="[runner] processing took 4.3µs with stages: nolint: 1.2µs, max_same_issues: 500ns, skip_dirs: 300ns, cgo: 200ns, uniq_by_line: 200ns, fixer: 200ns, max_from_linter: 200ns, max_per_file_from_linter: 200ns, filename_unadjuster: 200ns, source_code: 200ns, path_prefixer: 100ns, skip_files: 100ns, exclude: 100ns, autogenerated_exclude: 100ns, exclude-rules: 100ns, sort_results: 100ns, diff: 100ns, identifier_marker: 100ns, path_prettifier: 100ns, severity-rules: 0s, path_shortener: 0s"
  level=info msg="[runner] linters took 7.854776428s with stages: goanalysis_metalinter: 7.854719828s"
  level=error msg="Running error: 1 error occurred:\n\t* can't run linter goanalysis_metalinter: buildssa: failed to load package {{package_name}}: could not load export data: no export data for \"{{package_path}}\"\n\n"
  level=info msg="Memory: [14]({{myrepo}}6#step:6:15)1 samples, avg is [20]({{myrepo}}#step:6:21)0.0MB, max is 714.2MB"
  level=info msg="Execution took 13.90[25]({{myrepo}}#step:6:26)825s"
  
  Error: golangci-lint exit with code 3
  Ran golangci-lint in 146[26]({{myrepo}}#step:6:27)ms

I was able to unstuck myself by reverting to golangci-lint-action@v2, but at some point, I'll have to migrate to the most recent one.

I was able to find golangci/golangci-lint#3546 on the other repo, but it seems it has already been fixed.

Version of golangci-lint

1.52.2

Version of the GitHub Action

v3

Workflow file

.golangci.yaml

linters-settings:
  funlen:
    lines: 100
    statements: 50
  goconst:
    min-len: 2
    min-occurrences: 2
  gocritic:
    enabled-tags:
      - diagnostic
      - experimental
      - opinionated
      - performance
      - style
  gocyclo:
    min-complexity: 15
  godot:
    capital: true
  goimports:
    local-prefixes: github.com/golangci/golangci-lint
  govet:
    settings:
      printf:
        funcs:
          - (github.com/golangci/golangci-lint/pkg/logutils.Log).Infof
          - (github.com/golangci/golangci-lint/pkg/logutils.Log).Warnf
          - (github.com/golangci/golangci-lint/pkg/logutils.Log).Errorf
          - (github.com/golangci/golangci-lint/pkg/logutils.Log).Fatalf
    enable:
      - fieldalignment
  lll:
    line-length: 140
  maligned:
    suggest-new: true
  misspell:
    locale: UK
  unparam:
    check-exported: true

issues:
  # Excluding configuration per-path, per-linter, per-text and per-source
  exclude-rules:
    - path: _test\.go
      linters:
        - gosec # security check is not important in tests
        - dupl  # we usually duplicate code in tests
        - bodyclose
        - unparam
        - errcheck
        - govet
    - path: testing
      linters:
        - errcheck
  fix: true
  exclude-use-default: false

run:
  skip-dirs:
    - model
    - tmp
    - bin
    - scripts

  tests: true
  build-tags:
    - integration

linters:
  disable-all: true
  fast: true
  enable:
    - asciicheck
    - bidichk
    - bodyclose
    - bodyclose
    - containedctx
    - contextcheck
    - cyclop
    - decorder
    - depguard
    - dogsled
    - dupl
    - durationcheck
    - errcheck
    - errchkjson
    - errname
    - errorlint
    - exhaustive
    - exportloopref
    - forbidigo
    - forcetypeassert
    - funlen
    - gocognit
    - goconst
    - gocritic
    - gocyclo
    - godot
    - godox
    - gofmt
    - gofumpt
    - goheader
    - goimports
    - gomnd
    - gomoddirectives
    - gomodguard
    - goprintffuncname
    - gosec
    - gosec
    - gosimple
    - gosimple
    - govet
    - govet
    - grouper
    - importas
    - ineffassign
    - ireturn
    - lll
    - maintidx
    - makezero
    - misspell
    - nakedret
    - nestif
    - nilerr
    - nilnil
    - nlreturn
    - noctx
    - nolintlint
    - prealloc
    - predeclared
    - promlinter
    - revive
    - rowserrcheck
    - sqlclosecheck
    - staticcheck
    - staticcheck
    - stylecheck
    - tagliatelle
    - tenv
    - thelper
    - tparallel
    - typecheck
    - unconvert
    - unparam
    - unused
    - varnamelen
    - wastedassign
    - whitespace
    - wrapcheck

# golangci.com configuration
# https://github.com/golangci/golangci/wiki/Configuration
service:
  golangci-lint-version: 1.52.x
  prepare:
    - make coverage
    - make image
.github/workflows/go.yml
name: Go

on:
  push:
    branches: [main]
  pull_request:
    branches:
      - main
      - feature/*
      - fix/*

jobs:
  label:
    runs-on: ubuntu-latest
    permissions:
      contents: read
      pull-requests: write

    steps:
      - uses: actions/labeler@v4
        with:
          repo-token: "${{ secrets.GITHUB_TOKEN }}"

  lint:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout repo
        uses: actions/checkout@v3
      - name: Granting Private Modules Access
        env:
          GITHUB_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
          GITHUB_USER: {{myuser}}
          GOPRIVATE: {{mygoprivate}}
        run: git config --global url."https://${GITHUB_USER}:${GITHUB_TOKEN}@github.com".insteadOf "https://github.com"

      - name: golangci-lint
        uses: golangci/golangci-lint-action@v3
        with:
          args: --verbose --timeout 5m0s

Go version

1.20.2

Code example or link to a public repository

Unfortunately, code is not public.

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