-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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 ." should be run in the package directory, not in subdirectories #1657
Comments
Sounds good. Someone with knowledge of Go can pick this up whenever they want. |
What kind of "false positive" do you get? It seems to work correctly as far as I can see? You do have some compile errors in the |
That's not a Go package. It's just a subdirectory for stand-alone examples.
Those are compiled separately to generate different executables. Both "go vet examples/web_crawler.go" and "go vet web_crawler.go" work properly, with no errors reported. |
Every directory within GOPATH with Go files is a package. See
This is not really something that Go supports; almost all Go tools – such as The most notable exception is Stuff like The standard way to work around this sort of thing is to guard those files with build tags:
Since Other than that, it seems to me that declaring the same function in the same package is exactly the kind of error that I would expect a linter to report? |
This works for me.
I don't know what you're trying to run there. It's just "go test" in the top dir and it works just fine. |
I have a subdirectory named "examples" in https://github.com/stefantalpalaru/pool and the default Go linter runs "go vet ." in that subdir instead of the package dir, leading to false positives for "examples/web_crawler.go".
There are two ways to fix this:
The text was updated successfully, but these errors were encountered: