Skip to content

nolint yet linter says: "could not load export data"… #1466

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
3 tasks done
kierun opened this issue Oct 23, 2020 · 3 comments
Closed
3 tasks done

nolint yet linter says: "could not load export data"… #1466

kierun opened this issue Oct 23, 2020 · 3 comments
Labels
area: nolint Related to nolint directive and nolintlint question Further information is requested

Comments

@kierun
Copy link

kierun commented Oct 23, 2020

Thank you for creating the issue!

  • 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).

Please include the following information:

Version of golangci-lint
$ golangci-lint --version
golangci-lint has version v1.31.1-0.20201009124248-796a95880598 built from (unknown, mod sum: "h1:yo3wFdeBXUjQ4KdXovTyrva5sSE53N9fGUgWgRTakzo=") on (unknown)
Config file
$ cat .golangci.yml
# paste output here
service:
  golangci-lint-version: 1.31.1

run:
  timeout: 5m
  modules-download-mode: vendor
  skip-dirs:
    - store/storetest/mocks

linters-settings:
  gofmt:
    simplify: true
  govet:
    check-shadowing: true
    enable-all: true

linters:
  disable-all: true
  enable:
    - deadcode
    - gofmt
    - golint
    - gosimple
    - govet
    - ineffassign
    - scopelint
    - structcheck
    - unconvert
    - unused
    - varcheck
    # TODO: enable this later
    # - errcheck

issues:
  exclude-rules:
    - linters:
      # ignore unused warnings from enterprise code
      # add more as required.
      - unused
      text: "RedisSupplier|LocalCacheSupplier|Enterprise"

    - linters:
      - scopelint
      # ignore warnings from table tests. https://github.com/kyoh86/scopelint/issues/4
      path: ".*_test.go|store/storetest"

    - linters:
      # ignore golint error for a lot of packages for now
      - golint
      path: "api4|app|cmd|einterface|enterprise|jobs|migrations|mlog|model|testlib|services|store|utils|web|wsapi|plugin/plugintest/api.go|plugin/api.go|plugin/context.go|plugin/client.go|plugin/client_rpc.go|plugin/client_rpc_generated.go|plugin/api_timer_layer_generated.go|plugin/hooks_timer_layer_generated|plugin/environment.go|plugin/health_check.go|plugin/hooks.go|plugin/supervisor.go|plugin/valid.go"
Go environment
$ go version && go env
go version go1.14.9 linux/amd64
GO111MODULE="on"
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/usr/.cache/go-build"
GOENV="/home/usr/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/usr/go"
GOPRIVATE=""
GOPROXY="direct"
GOROOT="/usr/lib/golang"
GOSUMDB="off"
GOTMPDIR=""
GOTOOLDIR="/usr/lib/golang/pkg/tool/linux_amd64"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/home/usr/org/github/server/go.mod"
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 -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build575271080=/tmp/go-build -gno-record-gcc-switches"
Verbose output of running
$ golangci-lint cache clean
$ golangci-lint run -v
WARN [runner] Can't run linter goanalysis_metalinter: deadcode: analysis skipped: errors in package: [/home/usr/org/github/server/ook_test.go:7:2: could not import gopkg.in/h2non/gock.v1 (ook_test.go:7:2: cannot find package "." in:
        /home/usr/org/github/server/vendor/gopkg.in/h2non/gock.v1) /home/usr/org/github/server/ook_test.go:11:8: undeclared name: gock /home/usr/org/github/server/ook_test.go:7:2: "gopkg.in/h2non/gock.v1" imported but not used]
WARN [runner] Can't run linter unused: buildir: failed to load package : could not load export data: no export data for "gopkg.in/h2non/gock.v1"
ERRO Running error: buildir: failed to load package : could not load export data: no export data for "gopkg.in/h2non/gock.v1"
✗ 3 (feature/vault|+2…2); golangci-lint run -v ook_test.go
INFO [config_reader] Config search paths: [./ /home/usr/org/github/server /home/usr/org/github /home/usr/org /home/usr /home /]
INFO [config_reader] Used config file .golangci.yml
INFO [lintersdb] Active 11 linters: [deadcode gofmt golint gosimple govet ineffassign scopelint structcheck unconvert unused varcheck]
INFO [loader] Go packages loading at mode 575 (types_sizes|exports_file|name|imports|compiled_files|deps|files) took 81.787853ms
INFO [runner/filename_unadjuster] Pre-built 0 adjustments in 71.641µs
INFO [linters context/goanalysis] analyzers took 1.384401ms with top 10 stages: printf: 117.671µs, ctrlflow: 74.101µs, assign: 45.08µs, lostcancel: 41.39µs, S1025: 33.96µs, buildtag: 32.58µs, inspect: 27.84µs, atomic: 25.45µs, varcheck: 24.65µs, findcall: 23.921µs
WARN [runner] Can't run linter goanalysis_metalinter: deadcode: analysis skipped: errors in package: [/home/usr/org/github/server/ook_test.go:7:2: could not import gopkg.in/h2non/gock.v1 (ook_test.go:7:2: cannot find package "." in:
        /home/usr/org/github/server/vendor/gopkg.in/h2non/gock.v1) /home/usr/org/github/server/ook_test.go:11:8: undeclared name: gock /home/usr/org/github/server/ook_test.go:7:2: "gopkg.in/h2non/gock.v1" imported but not used]
INFO [linters context/goanalysis] analyzers took 518.624µs with top 10 stages: buildir: 316.072µs, U1000: 202.552µs
WARN [runner] Can't run linter unused: buildir: failed to load package : could not load export data: no export data for "gopkg.in/h2non/gock.v1"
INFO [runner] processing took 3.83µs with stages: max_same_issues: 410ns, cgo: 370ns, identifier_marker: 350ns, skip_dirs: 330ns, path_prettifier: 290ns, nolint: 290ns, diff: 280ns, max_from_linter: 260ns, skip_files: 260ns, filename_unadjuster: 210ns, autogenerated_exclude: 170ns, exclude: 130ns, exclude-rules: 120ns, uniq_by_line: 120ns, sort_results: 40ns, path_shortener: 40ns, path_prefixer: 40ns, max_per_file_from_linter: 40ns, source_code: 40ns, severity-rules: 40ns
INFO [runner] linters took 80.07906ms with stages: goanalysis_metalinter: 53.885257ms, unused: 26.159183ms
ERRO Running error: buildir: failed to load package : could not load export data: no export data for "gopkg.in/h2non/gock.v1"
INFO Memory: 3 samples, avg is 71.7MB, max is 72.6MB
INFO Execution took 166.051195ms

I have this test file:

//nolint
package main

import (
	"testing"

	"gopkg.in/h2non/gock.v1" //nolint
)

func TestNoLint(t *testing.T) {
	defer gock.Off() //nolint
}

When I run golangci-lint run I get:

WARN [runner] Can't run linter unused: buildir: failed to load package : could not load export data: no export data for "gopkg.in/h2non/gock.v1"

Am I missing something here?

@kierun kierun added the bug Something isn't working label Oct 23, 2020
@boring-cyborg
Copy link

boring-cyborg bot commented Oct 23, 2020

Hey, thank you for opening your first Issue ! 🙂 If you would like to contribute we have a guide for contributors.

@ldez
Copy link
Member

ldez commented Mar 19, 2021

Hello,

I tried to reproduce with the snippet and your configuration (with different golangci-lint versions) and I don't reproduce it.

We need more information to be able to reproduce this issue.

@ldez ldez added the feedback required Requires additional feedback label Mar 19, 2021
@kierun
Copy link
Author

kierun commented Mar 19, 2021

I cannot reproduce the issue as well. Guess some voodoo magic fixed it somewhere. Thank you for your help.

@kierun kierun closed this as completed Mar 19, 2021
@ldez ldez added question Further information is requested area: nolint Related to nolint directive and nolintlint and removed bug Something isn't working feedback required Requires additional feedback labels Mar 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: nolint Related to nolint directive and nolintlint question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants