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

cmd/vet: vet XTestGoFiles without directory walk #22296

Closed
dnephin opened this issue Oct 16, 2017 · 6 comments
Closed

cmd/vet: vet XTestGoFiles without directory walk #22296

dnephin opened this issue Oct 16, 2017 · 6 comments
Labels
FrozenDueToAge NeedsDecision Feedback is required from experts, contributors, and/or the community before a change can be made.
Milestone

Comments

@dnephin
Copy link
Contributor

dnephin commented Oct 16, 2017

Problem exists with all versions of go.

go tool vet supports args as either:

  1. files, all of which must be in the same package.
  2. a single directory, recursively descends the directory, vetting each package it finds.

Using files causes errors when there are external packages in the directory (ex: example_test.go uses pkg_test). The error is something like ExampleNewFilter refers to unknown identifier: NewFilter.

Using a directory walks the entire tree, which makes it impossible to ignore specific paths.

I propose to fix this issue by adding a --no-recurse flag to prevent the directory walk.

@gopherbot
Copy link

Change https://golang.org/cl/71170 mentions this issue: cmd/vet: Add a no-recurse flag to govet to prevent directory walk

@ianlancetaylor ianlancetaylor changed the title cmd/govet: vet XTestGoFiles without directory walk cmd/vet: vet XTestGoFiles without directory walk Oct 16, 2017
@ianlancetaylor ianlancetaylor added the NeedsDecision Feedback is required from experts, contributors, and/or the community before a change can be made. label Oct 16, 2017
@ianlancetaylor ianlancetaylor added this to the Go1.10 milestone Oct 16, 2017
@ianlancetaylor
Copy link
Contributor

Why not simply use go vet to vet the exact packages you want to check?

@dnephin
Copy link
Contributor Author

dnephin commented Oct 16, 2017

go vet does not support any of the flags (-shadow, -all, etc).

@ianlancetaylor
Copy link
Contributor

go vet does not support any of the flags (-shadow, -all, etc).

That has been fixed as of the 1.9 release (see #19350).

@dnephin
Copy link
Contributor Author

dnephin commented Oct 16, 2017

Ah, Thanks! I missed that. That should work I think.

@ianlancetaylor
Copy link
Contributor

OK, I'm going to close this issue. Please comment if you disagree.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsDecision Feedback is required from experts, contributors, and/or the community before a change can be made.
Projects
None yet
Development

No branches or pull requests

3 participants