jarcoal / httpmock

HTTP mocking for Golang
http://godoc.org/github.com/jarcoal/httpmock
MIT License
1.93k stars 103 forks source link

golangcli-lint says no export data for "github.com/jarcoal/httpmock" #98

Closed ghost closed 4 years ago

ghost commented 4 years ago

I am trying to run golangcli-lint, and got this:

WARN [runner] Can't run linter goanalysis_metalinter: deadcode: analysis skipped: errors in package: [/home/yann/worldr/github/server/vault_test.go:9:2: could not import github.com/jarcoal/httpmock (vault_test.go:9:2: cannot find package "." in:
        /home/yann/worldr/github/server/vendor/github.com/jarcoal/httpmock)]
WARN [runner] Can't run linter unused: buildir: failed to load package : could not load export data: no export data for "github.com/jarcoal/httpmock"
ERRO Running error: buildir: failed to load package : could not load export data: no export data for "github.com/jarcoal/httpmock"

Any idea how to fix that?

maxatome commented 4 years ago

Hi, In which repo do you run the linter? It seems you vendored httpmock, but without more information, it is very difficult to help you.

ghost commented 4 years ago

I use go modules in this one although the changes I did with httpmock are not committed since I got the error above. If you add a test file anywhere there and run make check-style, the error should pop out.

I re-wrote the tests with httptest but I would rather use httpmock as it's nicer.

maxatome commented 4 years ago

As you use now go modules, you have to remove the vendor/ directory. This way, the linter won't visit it.

ghost commented 4 years ago

Hum, I tried to remove the vendor directory. That caused some mayhem… Something to investigate I suppose. I guess that does solve the problem or at least points me to the right solution so this can be close.

Thank you so much for your help.