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

Comments

Projects
None yet
3 participants
@dnephin
Copy link
Contributor

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

This comment has been minimized.

Copy link

commented Oct 16, 2017

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 this to the Go1.10 milestone Oct 16, 2017

@ianlancetaylor

This comment has been minimized.

Copy link
Contributor

commented Oct 16, 2017

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

@dnephin

This comment has been minimized.

Copy link
Contributor Author

commented Oct 16, 2017

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

@ianlancetaylor

This comment has been minimized.

Copy link
Contributor

commented Oct 16, 2017

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

This comment has been minimized.

Copy link
Contributor Author

commented Oct 16, 2017

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

@ianlancetaylor

This comment has been minimized.

Copy link
Contributor

commented Oct 16, 2017

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

@dnephin dnephin referenced this issue Aug 14, 2018

Merged

Add gotest.tools #2053

7 of 7 tasks complete

@golang golang locked and limited conversation to collaborators Oct 16, 2018

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
You can’t perform that action at this time.