Skip to content

Can't run linter goanalysis_metalinter: inspect: failed to load package jsonpatch: could not load export data: no export data for \"github.com/evanphx/json-patch/v5\" #5051

@lucastheisen

Description

@lucastheisen

Welcome

  • Yes, I'm using a binary release within 2 latest releases. Only such installations are supported.
  • Yes, I've searched similar issues on GitHub and didn't find any.
  • Yes, I've read the typecheck section of the FAQ.
  • Yes, I've tried with the standalone linter if available (e.g., gocritic, go vet, etc.).
  • I agree to follow this project's Code of Conduct

Description of the problem

When running as part of a gitlab action, the step fails with:

  Running [/home/runner/golangci-lint-1.61.0-linux-amd64/golangci-lint run] in [/home/runner/work/clconf/clconf] ...
  Received 232188 of 232188 (100.0%), 0.2 MBs/sec
  level=warning msg="[runner] Can't run linter goanalysis_metalinter: inspect: failed to load package jsonpatch: could not load export data: no export data for \"github.com/evanphx/json-patch/v5\""
  level=error msg="Running error: can't run linter goanalysis_metalinter\ninspect: failed to load package jsonpatch: could not load export data: no export data for \"github.com/evanphx/json-patch/v5\""
  
  Error: golangci-lint exit with code 3
  Ran golangci-lint in 6975ms

When running local, i cannot reproduce this error:

ltheisen@ltop ~/egit/pastdev-clconf
$ ~/tmp/glcil/golangci-lint-1.61.0-linux-amd64/golangci-lint run --max-same-issues 100000 --max-issues-per-linter 1000000

ltheisen@ltop ~/egit/pastdev-clconf
$ echo $?
0

Version of golangci-lint

$ golangci-lint --version
# Paste output here

I cannot run this command directly as it is part of the gitlab action, but the configuration explicitly says:

  lint:
    name: lint
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-go@v5
        with:
          go-version-file: go.mod
          cache: true
      - name: golangci-lint
        uses: golangci/golangci-lint-action@v6
        with:
          version: v1.61

Configuration

.golangci.yml

---
linters:
  disable-all: true
  enable:
  - asciicheck
  - bidichk
  - durationcheck
  - exhaustive
  - errcheck
  - errorlint
  - gochecknoinits
  - goconst
  - gocritic
  - gofmt
  - gosec
  - gosimple
  - govet
  - ineffassign
  - nakedret
  - nilerr
  - nolintlint
  - revive
  - sqlclosecheck
  - staticcheck
  - typecheck
  - unparam
  - unused
  - wastedassign
  - whitespace
  - wrapcheck
issues:
  include:
  # Reenable some checks golangci-lint disables by default (see golangci-lint run --help)
  - EXC0001
  - EXC0004
  - EXC0005
  - EXC0006
  - EXC0007
linters-settings:
  errcheck:
    ignore: "" # Disable the overbroad ignore rules (they ignore things like Fprintf)

Go environment

$ go version && go env
# paste output here

I cannot get this output explicitly because its a github action, but that action config is:

  lint:
    name: lint
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-go@v5
        with:
          go-version-file: go.mod
          cache: true
      - name: golangci-lint
        uses: golangci/golangci-lint-action@v6
        with:
          version: v1.61

which uses my go.mod for version which is:

go 1.17

The env is what gets set by actions/setup-go@v5.

Verbose output of running

$ golangci-lint cache clean
$ golangci-lint run -v
# paste output here

After adding -v to the args in my action config, the output is:

  Running [/home/runner/golangci-lint-1.61.0-linux-amd64/golangci-lint run  -v] in [/home/runner/work/clconf/clconf] ...
  Received 232188 of 232188 (100.0%), 0.2 MBs/sec
  level=info msg="golangci-lint has version 1.61.0 built with go1.23.1 from a1d6c560 on 2024-09-09T17:44:42Z"
  level=info msg="[config_reader] Config search paths: [./ /home/runner/work/clconf/clconf /home/runner/work/clconf /home/runner/work /home/runner /home /]"
  level=info msg="[config_reader] Used config file .golangci.yml"
  level=info msg="[lintersdb] Active 25 linters: [asciicheck bidichk durationcheck errcheck errorlint exhaustive gochecknoinits goconst gocritic gofmt gosec gosimple govet ineffassign nakedret nilerr nolintlint revive sqlclosecheck staticcheck unparam unused wastedassign whitespace wrapcheck]"
  level=info msg="[loader] Go packages loading at mode 575 (deps|types_sizes|compiled_files|exports_file|files|imports|name) took 3.036553838s"
  level=info msg="[runner/filename_unadjuster] Pre-built 0 adjustments in 7.125238ms"
  level=info msg="[linters_context/goanalysis] analyzers took 8.986602725s with top 10 stages: buildir: 6.205361567s, the_only_name: 728.649032ms, exhaustive: 654.855556ms, inspect: 256.964272ms, printf: 158.775463ms, ctrlflow: 129.19702ms, bidichk: 105.347993ms, fact_deprecated: 96.355674ms, fact_purity: 91.083523ms, SA5012: 83.371442ms"
  level=warning msg="[runner] Can't run linter goanalysis_metalinter: inspect: failed to load package jsonpatch: could not load export data: no export data for \"github.com/evanphx/json-patch/v5\""
  level=info msg="[runner] processing took 2.227µs with stages: max_same_issues: 291ns, skip_dirs: 251ns, cgo: 180ns, filename_unadjuster: 171ns, invalid_issue: 161ns, nolint: 161ns, max_from_linter: 151ns, identifier_marker: 150ns, skip_files: 140ns, exclude-rules: 51ns, fixer: 50ns, path_shortener: 50ns, source_code: 50ns, path_prefixer: 50ns, uniq_by_line: 40ns, max_per_file_from_linter: 40ns, diff: 40ns, exclude: 40ns, severity-rules: 40ns, autogenerated_exclude: 40ns, sort_results: 40ns, path_prettifier: 40ns"
  level=info msg="[runner] linters took 3.714493502s with stages: goanalysis_metalinter: 3.714462053s"
  level=error msg="Running error: can't run linter goanalysis_metalinter\ninspect: failed to load package jsonpatch: could not load export data: no export data for \"github.com/evanphx/json-patch/v5\""
  level=info msg="Memory: 69 samples, avg is 138.7MB, max is 325.1MB"
  level=info msg="Execution took 6.762238983s"
  Error: golangci-lint exit with code 3
  Ran golangci-lint in 6863ms

A minimal reproducible example or link to a public repository

The public repository is: https://github.com/pastdev/clconf, specifically this PR:

pastdev/clconf#52

// add your code here

Validation

  • Yes, I've included all information above (version, config, etc.).

Supporter

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