Skip to content

"no export data for" error since v1.44 #3376

Closed
@albertteoh

Description

@albertteoh

Welcome

  • Yes, I'm using a binary release within 2 latest major releases. Only such installations are supported.
  • Yes, I've searched similar issues on GitHub and didn't find any.
  • Yes, I've included all information below (version, config, etc.).
  • Yes, I've tried with the standalone linter if available (e.g., gocritic, go vet, etc.). (https://golangci-lint.run/usage/linters/)

Description of the problem

Running the linter returns the following error:

WARN [runner] Can't run linter goanalysis_metalinter: buildir: failed to load package proj: could not load export data: no export data for "github.com/pebbe/go-proj-4/proj"
ERRO Running error: 1 error occurred:
	* can't run linter goanalysis_metalinter: buildir: failed to load package proj: could not load export data: no export data for "github.com/pebbe/go-proj-4/proj"

After a bit of debugging, I found returning nil appears to prevent the error, but may just be a hack that hides a deeper problem, which I think is around understanding why github.com/pebbe/go-proj-4/proj doesn't have an exportFile.

I'd be appreciative if someone could explain how exportFiles are generated and why it's missing for github.com/pebbe/go-proj-4/proj; or, if this is "expected", whether if my proposed change is an appropriate fix: https://github.com/golangci/golangci-lint/compare/master...albertteoh:golangci-lint:warn-instead-of-err-no-exportfile?expand=1.

Worth noting that I do not see this error when running with the docker image: golangci/golangci-lint:v1.43-alpine
... and this error starts appearing from golangci/golangci-lint:v1.44-alpine.

Version of golangci-lint

$ golangci-lint --version
golangci-lint has version 1.50.1 built from 8926a95f on 2022-10-22T10:50:47Z

Configuration file

$ cat .golangci.yml
run:
  timeout: 5m
  modules-download-mode: vendor
  go: "1.19"

issues:
  exclude-rules:
    - path: '(.+)_test\.go'
      linters:
        - gosec

linter-settings:
  depguard:
    list-type: blacklist
    include-go-root: true
    packages:
      - io/ioutil
    packages-with-error-message:
      - io/ioutil: "Use os or io instead of io/ioutil"
  goimports:
    local-prefixes: github.com/nearmap/openworld
  gosimple:
    go: "1.19"
    checks: ["all"]

linters:
  fast: false
  enable:
    - depguard
    - gofmt
    - gofumpt
    - goimports
    - gosec
    - govet
    - misspell

Go environment

$ go version && go env
go version go1.19.1 linux/amd64
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/vagrant/.cache/go-build"
GOENV="/home/vagrant/.config/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/vagrant/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/vagrant/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GOVCS=""
GOVERSION="go1.19.1"
GCCGO="gccgo"
GOAMD64="v1"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/vagrant/go/src/github.com/nearmap/openworld/go.mod"
GOWORK=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build2885735728=/tmp/go-build -gno-record-gcc-switches"```

Verbose output of running

$ golangci-lint cache clean
$ golangci-lint run -v
INFO [config_reader] Config search paths: [./ /vagrant/go/src/github.com/nearmap/openworld /vagrant/go/src/github.com/nearmap /vagrant/go/src/github.com /vagrant/go/src /vagrant/go /vagrant / /home/vagrant]
INFO [config_reader] Used config file .golangci.yaml
INFO [lintersdb] Active 13 linters: [depguard errcheck gofmt gofumpt goimports gosec gosimple govet ineffassign misspell staticcheck typecheck unused]
INFO [loader] Go packages loading at mode 575 (compiled_files|exports_file|files|imports|deps|name|types_sizes) took 17.15944041s
INFO [runner/filename_unadjuster] Pre-built 0 adjustments in 134.341821ms
INFO [linters_context/goanalysis] analyzers took 1m15.456566948s with top 10 stages: buildir: 44.298340449s, gofumpt: 4.425482723s, goimports: 4.386180343s, gofmt: 4.236456711s, misspell: 4.019975918s, isgenerated: 3.115835806s, inspect: 1.612242537s, gosec: 1.222692737s, ctrlflow: 915.632099ms, printf: 880.704774ms
WARN [runner] Can't run linter goanalysis_metalinter: buildir: failed to load package proj: could not load export data: no export data for "github.com/pebbe/go-proj-4/proj"
INFO [runner] processing took 2.378µs with stages: max_same_issues: 450ns, max_from_linter: 298ns, nolint: 273ns, skip_dirs: 242ns, cgo: 112ns, filename_unadjuster: 102ns, skip_files: 101ns, uniq_by_line: 99ns, path_prettifier: 99ns, autogenerated_exclude: 97ns, severity-rules: 95ns, exclude: 92ns, max_per_file_from_linter: 44ns, diff: 44ns, sort_results: 43ns, exclude-rules: 40ns, identifier_marker: 38ns, path_shortener: 38ns, source_code: 37ns, path_prefixer: 34ns
INFO [runner] linters took 19.846467904s with stages: goanalysis_metalinter: 19.846438948s
ERRO Running error: 1 error occurred:
	* can't run linter goanalysis_metalinter: buildir: failed to load package proj: could not load export data: no export data for "github.com/pebbe/go-proj-4/proj"

INFO Memory: 370 samples, avg is 361.5MB, max is 1005.1MB
INFO Execution took 37.153737047s```

Code example or link to a public repository

This affects a private repository. However, the dependency that seems to be the cause of this error is: github.com/pebbe/go-proj-4/proj

// add your code here

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: cgoRelated to CGO or line directivesquestionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions