-
-
Notifications
You must be signed in to change notification settings - Fork 249
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
go_vet reports unknown identifier in example code #113
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: |
Looks like it's not |
Weird, |
What go versions are you guys using? I have a similar problem in one of my projects: it works with Go 1.5.X, but fails with Go 1.6.X Edit: Also see openshift/origin#4682 and golang/go#12636 |
Personally, I have the What is even weirder is that Go Report Card returns a 100% success for another package (github.com/gowww/log) which follows exactly the same "template". |
Same for this package: https://goreportcard.com/report/github.com/db47h/cache I use go 1.7 and go-tip as test code is not compatible with go <1.7, |
Maybe this is a caching issue? In my case, I got the false positive
Perhaps go vet is looking at the new version of the file example_test.go and an older cached version of the file that actually contains SortSlice. I did, in fact, use goreportcard earlier, when the new function and the new test didn't yet exist. |
@korthaj unfortunately I don't believe it's a caching issue but rather an issue with
If I can find a way to have |
At first glance, just calling |
I'm experiencing the same problem here |
Same experience with my new repo github.com/GoLangsam/template using unnamed import aka Local use of Local use of After patching
things are fine :-) (except for small and unrelated Windows-issues - and that's a separate story!) |
I will take a look at this soon. |
Looking @ alecthomas/gometalinter#218 I feel that they'r pushing this off to the go tool chain. Thus, there is no hope for any quick solution soon. Having browsed I also understand and experience: the best (if I may say so) way to point to packages is inside a workspace ( Looking @ Your implementation, I see:
Thus: I just set my So, I'd humbly like to recommend: Stay far away from non-standard usage of package pointers when using go tools! (Note: There's even a myriad of issues, blogs etc. around explaining very good reasone as of why some usage styles have to behave in ways unexpected to the naive and innocent user.) |
@shawnps Having found a.m. evidence, I'll have to read and think a little more in order to come up with a feasible and robust solution which suits Your fine product. |
here we go - Sorry for keeping You waiting :-) |
This is still an issue, I've raised it against go vet: |
As suggested by Russ Cox if the calls to |
I have a similar problem with my package logstash-config. Locally
The |
I hit this regularly when working with examples (with a _test package name). Gometalinter will pass locally but goreportcard reports these false warnings. In most cases, I am able to change the example to use the same package name but sometimes that causes import cycles.... |
1. make calls to String() explicit 2. move the examples to the did package to address this bug in gometalinter gojp/goreportcard#113
Have the same problem in this report https://goreportcard.com/report/github.com/ockam-network/did Locally |
I'm having the same issue on my repo. I was able to reproduce by running
|
hi, |
This issue is stale because it has been open 60 days with no activity. |
For example, the github.com/gowww/compress package.
The package name
compress
is suffixed with_test
inside theexample_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.The text was updated successfully, but these errors were encountered: