goreportcard: go_vet reports unknown identifier in example code

For example, the github.com/gowww/compress package.

The package name compress is suffixed with _test inside the example_test.go file. That’s maybe why this go vet doesn’t recognize the identifier reference.

But it should. And locally, my go vet github.com/gowww/compress returns no error.

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Reactions: 7
  • Comments: 24 (5 by maintainers)

Commits related to this issue

Most upvoted comments

@arthurwhite that is strange behavior indeed.

i can’t reproduce it on my local, but i see it failing on the go report card server. i opened a ticket with gometalinter, will see what the author says:

https://github.com/alecthomas/gometalinter/issues/108

@shawnps @hermanschaaf

here we go - Sorry for keeping You waiting 😃

I will take a look at this soon.

@korthaj unfortunately I don’t believe it’s a caching issue but rather an issue with go tool vet itself. I just ran it manually against your repo and I get the error:

$ go tool vet *.go
example_test.go:8: ExampleSortSlice refers to unknown identifier: SortSlice

gometalinter uses go tool vet rather than go vet, I believe for historical reasons. Someone brought up a similar issue here:

https://github.com/alecthomas/gometalinter/issues/218

If I can find a way to have gometalinter use go vet instead of go tool vet, it might be fixable.