You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've read this issue and the linked thread that decided against supporting a line-specific "ignore vet" annotation. I'm wondering if there's an appetite for allowing go vet to ignore files.
One proposal would be to extend the packages syntax to allow "exclude" directives. Two mockups of this usage:
go vet ./my/package/... --exclude=./my/package/known_bad_file.go --exclude=./my/package/other/bad_file.go
go vet ./my/package/... _./my/package/known_bad_file.go _./my/package/other/bad_file.go (I personally think this is less obvious than --exclude, but it rhymes with the existing "ignore files that begin with _" syntax)
The specific use case here is that we have a legacy codebase that was developed without any vet/lint rules. Most files are fine, but there are enough files that have issues that it's not practical to clean them all up before we can start enforcing go vet. In order to clean up the codebase incrementally, I'd like to be able to enforce that go vet passes for currently-valid files and all future files, ignoring the currently-broken files for now until we can clean them up one-by-one.
The text was updated successfully, but these errors were encountered:
Perhaps I'm misinterpreting the suggestions, but neither go build -toolexec nor build tags seem to work for this use case.
go build -toolexec
When I try to run vet using -toolexec (go build -toolexec="/path/to/vet" ./my/package/...), I get an error response from vet:
go tool compile: exit status 1
vet: invoking "go tool vet" directly is unsupported; use "go vet"
Perhaps I'm using the wrong path to the vet executable?
build tags
When I add a build tag to the top of one of the files with known vet failures (//go:build ignore_vet) then run go vet ./my/package/..., vet will skip the ignored file while building, not while vetting. The problem is that other files that depend on the ignored file will now throw errors because the type and function definitions exported by the ignored file can't be found.
What I really want is a way to build all files but suppress vet output from a select set of files.
I've read this issue and the linked thread that decided against supporting a line-specific "ignore vet" annotation. I'm wondering if there's an appetite for allowing
go vet
to ignore files.One proposal would be to extend the
packages
syntax to allow "exclude" directives. Two mockups of this usage:go vet ./my/package/... --exclude=./my/package/known_bad_file.go --exclude=./my/package/other/bad_file.go
go vet ./my/package/... _./my/package/known_bad_file.go _./my/package/other/bad_file.go
(I personally think this is less obvious than--exclude
, but it rhymes with the existing "ignore files that begin with _" syntax)The specific use case here is that we have a legacy codebase that was developed without any vet/lint rules. Most files are fine, but there are enough files that have issues that it's not practical to clean them all up before we can start enforcing
go vet
. In order to clean up the codebase incrementally, I'd like to be able to enforce thatgo vet
passes for currently-valid files and all future files, ignoring the currently-broken files for now until we can clean them up one-by-one.The text was updated successfully, but these errors were encountered: