Skip to content
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

golangci-lint complains that no export data for "gopkg.in/h2non/gock.v1" #74

Open
ghost opened this issue Sep 18, 2020 · 6 comments
Open

Comments

@ghost
Copy link

ghost commented Sep 18, 2020

I copied the example from the README and tried to run golangci-lint on it. This is what I got:

√ ; lsd -l ook.go
.rw-rw-r-- yann yann 294 B Fri Sep 18 12:06:18 2020  ook.go
√ ; bat ook.go
       File: ook.go
   1   package main
   2
   3   import (
   4       "testing"
   5
   6       "gopkg.in/h2non/gock.v1"
   7   )
   8
   9   func TestFoo(t *testing.T) {
  10       defer gock.Off() // Flush pending mocks after test execution
  11
  12       gock.New("http://server.com").
  13           Get("/bar").
  14           Reply(200).
  15           JSON(map[string]string{"foo": "bar"})
  16
  17       // Your test code starts here...
  18   }
√ ; golangci-lint run ook.go
WARN [runner] Can't run linter goanalysis_metalinter: S1033: failed prerequisites: [(inspect@command-line-arguments, isgenerated@command-line-arguments): analysis skipped: errors in package: [/home/yann/tmp/ook.go:6:2: could not import gopkg.in/h2non/gock.v1 (ook.go:6:2: cannot find module providing package gopkg.in/h2non/gock.v1: working directory is not part of a module) /home/yann/tmp/ook.go:10:8: undeclared name: gock /home/yann/tmp/ook.go:12:2: undeclared name: gock /home/yann/tmp/ook.go:6: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 ;

Am I doing something wrong? If so, what? If not, is that a bug? …

@h2non
Copy link
Owner

h2non commented Sep 28, 2020

Gotta migrate the package namespace to github.com in a future release.

@ghost
Copy link
Author

ghost commented Oct 23, 2020

Any update on this? It is blocking my CI. ☹

@ghost
Copy link
Author

ghost commented Oct 23, 2020

In the meantime, is there a way to make golangci-lint skip whatever file(s) use gock? I tried skip_file but that is no use since it does the linting, just skips the results. I tried //nolint but that seems to do nothing whatsoever.

@h2non
Copy link
Owner

h2non commented Oct 25, 2020

Have no time nowadays. PR would be very welcome!

@ghost
Copy link
Author

ghost commented Oct 25, 2020

PR would be very welcome!

Let me see what I can do… I never did that before, so I'll have to read up on it all.

@ghost
Copy link
Author

ghost commented Oct 26, 2020

I tried this and I am still getting the same error. ☹

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant