go test

'Go test' automates testing the packages named by the import paths.


Go Versions


Go Versions

Supported Languages


Official Documentation


YAML Configuration


  • input:

    Patterns to include in execution and reports.

    Note: Inspecode runs go test for each Go package and the input patterns are used for selecting Go packages 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.

  • ignore:

    Patterns to exclude from execution and reports.

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

  • auto-fix:


  • config-file:


  • machine:

    • cpu:

      Amount of CPU. The default machine has 0.75 CPU with 2880 MiB RAM.

  • options:

    Below is the list of options that are supported:

    build flags:
      -tags 'tag list'
        a list of build tags to consider satisfied during the build.
        For more information about build tags, see the description of
        build constraints in the documentation for the go/build package.
    test flags:
      -bench regexp
          Run (sub)benchmarks matching a regular expression.
          The given regular expression is split into smaller ones by
          top-level '/', where each must match the corresponding part of a
          benchmark's identifier.
          By default, no benchmarks run. To run all benchmarks,
          use '-bench .' or '-bench=.'.
      -benchtime t
          Run enough iterations of each benchmark to take t, specified
          as a time.Duration (for example, -benchtime 1h30s).
          The default is 1 second (1s).
      -count n
          Run each test and benchmark n times (default 1).
          If -cpu is set, run n times for each GOMAXPROCS value.
          Examples are always run once.
          Enable coverage analysis.
      -covermode set,count,atomic
          Set the mode for coverage analysis for the package[s]
          being tested. The default is "set" unless -race is enabled,
          in which case it is "atomic".
          The values:
        set: bool: does this statement run?
        count: int: how many times does this statement run?
        atomic: int: count, but correct in multithreaded tests;
          significantly more expensive.
          Sets -cover.
      -coverpkg pkg1,pkg2,pkg3
          Apply coverage analysis in each test to the given list of packages.
          The default is for each test to analyze only the package being tested.
          Packages are specified as import paths.
          Sets -cover.
      -cpu 1,2,4
          Specify a list of GOMAXPROCS values for which the tests or
          benchmarks should be executed.  The default is the current value
          of GOMAXPROCS.
      -parallel n
          Allow parallel execution of test functions that call t.Parallel.
          The value of this flag is the maximum number of tests to run
          simultaneously; by default, it is set to the value of GOMAXPROCS.
          Note that -parallel only applies within a single test binary.
          The 'go test' command may run tests for different packages
          in parallel as well, according to the setting of the -p flag
          (see 'go help build').
      -run regexp
          Run only those tests and examples matching the regular expression.
          For tests the regular expression is split into smaller ones by
          top-level '/', where each must match the corresponding part of a
          test's identifier.
          Tell long-running tests to shorten their run time.
          It is off by default but set during all.bash so that installing
          the Go tree can run a sanity check but not spend time running
          exhaustive tests.
      -timeout t
          If a test runs longer than t, panic.
          The default is 10 minutes (10m).
  • thresholds:

    • num-issues:

      No tool specific severity levels are available.

  • incremental:


    Note: The incremental analysis cannot be supported for go test. This is because go test requires buildable packages to work and the results on unchanged files can be affected by changed files.

  • experimental:

    No tool specific experimental options are available.

YAML Examples

  • With default options:

        go-test: default

    By default, no options are specified to go test command.

  • With custom machine:

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

            - -tags: tag1,tag2 # A YAML sequence like [tag1, tag2] is also acceptable.
            - -cover
            - -short

Resolving Dependencies

Inspecode runs one of the following commands by automatically detecting the package management tool used in your repository:

In addition, Inspecode runs git submodule update --init --recursive if .gitmodules is placed at the root of your repository.

As of now, Inspecode can download:

  • packages available to the public
  • packages provided from your private repositories which:
    • belong to the same GitHub organization or Bitbucket team as the target repository
    • have been already registered to Inspecode

Note: Even if resolving dependencies fails due to some reasons, Inspecode continues the job.

results matching ""

    No results matching ""