Vet examines Go source code and reports suspicious constructs, such as Printf calls whose arguments do not align with the format string.
Patterns to include in execution and reports.
Note: Inspecode runs go tool vet for each Go package directory and go tool vet processes all files in the directory recursively. The input patterns are used for selecting the directories containing input files. Therefore, the files excluded by the patterns are processed if they are contained in Go packages that also contain input files, and you may even see logs related to the excluded files in the job console. However, Inspecode eventually ignores any issues detected on the excluded files when generating job reports.
Patterns to exclude from execution and reports.
Note: Just like
input:, the ignore patterns may not be applied completely when running go tool vet.
Amount of CPU. The default machine has
0.25 CPU with
960 MiB RAM.
Below is the list of options that are supported:
-all enable all non-experimental checks -asmdecl check assembly against Go declarations -assign check for useless assignments -atomic check for common mistaken usages of the sync/atomic package -bool check for mistakes involving boolean operators -buildtags check that +build tags are valid -cgocall check for types that may not be passed to cgo calls -composites check that composite literals used field-keyed elements -compositewhitelist use composite white list; for testing only (default true) -copylocks check that locks are not passed by value -httpresponse check errors are checked before using an http Response -lostcancel check for failure to call cancelation function returned by context.WithCancel -methods check that canonically named methods are canonically defined -nilfunc check for comparisons between functions and nil -printf check printf-like invocations -printfuncs string comma-separated list of print function names to check -rangeloops check that range loop variables are used correctly -shadow check for shadowed variables (experimental; must be set explicitly) -shadowstrict whether to be strict about shadowing; can be noisy -shift check for useless shifts -structtags check that struct field tags have canonical format and apply to exported fields as needed -tags string space-separated list of build tags to apply when parsing -tests check for common mistaken usages of tests/documentation examples -unreachable check for unreachable code -unsafeptr check for misuse of unsafe.Pointer -unusedfuncs string comma-separated list of functions whose results must be used (default "errors.New,fmt.Errorf,fmt.Sprintf,fmt.Sprint,sort.Reverse") -unusedresult check for unused result of calls to functions in -unusedfuncs list and methods in -unusedstringmethods list -unusedstringmethods string comma-separated list of names of methods of type func() string whose results must be used (default "Error,String")
No tool specific severity levels are available.
Note: The incremental analysis cannot be supported for go tool vet. This is because go tool vet requires buildable packages to work and the results on unchanged files can be affected by changed files.
With default options:
inspecode: go-vet: default
With custom machine:
inspecode: go-vet: machine: cpu: 1.5 # 1.5 CPU, 5760 MiB RAM
With custom options:
inspecode: go-vet: options: [-printf, -shadow]
go vet requires all build dependencies to run, so Inspecode resolves the dependencies in the same manner as the go test's case. See the go test page for the details.