go tool vet

Vet examines Go source code and reports suspicious constructs, such as Printf calls whose arguments do not align with the format string.


Go Versions


Go Versions

Supported Languages


Official Documentation


YAML Configuration


  • input:

    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.

  • ignore:

    Patterns to exclude from execution and reports.

    Note: Just like input:, the ignore patterns may not be applied completely when running go tool vet.

  • auto-fix:


  • config-file:


  • machine:

    • cpu:

      Amount of CPU. The default machine has 0.25 CPU with 960 MiB RAM.

  • options:

    Below is the list of options that are supported:

            enable all non-experimental checks
            check assembly against Go declarations
            check for useless assignments
            check for common mistaken usages of the sync/atomic package
            check for mistakes involving boolean operators
            check that +build tags are valid
            check for types that may not be passed to cgo calls
            check that composite literals used field-keyed elements
            use composite white list; for testing only (default true)
            check that locks are not passed by value
            check errors are checked before using an http Response
            check for failure to call cancelation function returned by context.WithCancel
            check that canonically named methods are canonically defined
            check for comparisons between functions and nil
            check printf-like invocations
    -printfuncs string
            comma-separated list of print function names to check
            check that range loop variables are used correctly
            check for useless shifts
    -tags string
            space-separated list of build tags to apply when parsing
            check for common mistaken usages of tests/documentation examples
            check for unreachable code
            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")
            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")
  • thresholds:

    • num-issues:

      No tool specific severity levels are available.

  • experimental:

    • incremental:


      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.

YAML Examples

  • With default options:

      go-vet: default
  • With custom machine:

          cpu: 1.5 # 1.5 CPU, 5760 MiB RAM
  • With custom options:

        options: [-printf, -shadow]

Resolving Dependencies

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.

results matching ""

    No results matching ""