goimports

Command goimports updates your Go import lines, adding missing ones and removing unreferenced ones.

Version

e9f45831faab4562ce3f53f7196b67c08f948e86

Runtime

Go Versions

Supported Languages

Go

Official Documentation

https://godoc.org/golang.org/x/tools/cmd/goimports

YAML Configuration

goimports:

  • input:

    Patterns to include in execution and reports.

  • ignore:

    Patterns to exclude from execution and reports.

  • auto-fix:

    true/false

    Specifying true implies -w option.

    Note: As of now, goimports does not keep CRLF line endings and all EOL characters are converted to LF in files where the auto-fix is applied. We will solve this problem, but for the time being, please don't enable the auto-fix feature if you need to keep CRLF line endings.

  • config-file:

    N/A

  • 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:

    -local string
            put imports beginning with this string after 3rd-party packages; comma-separated list
    

YAML Examples

  • With default options:

    inspecode:
      goimports: default
    
  • With enabling auto-fixing and default options:

    inspecode:
      goimports: auto-fix
    
  • With custom machine:

    inspecode:
      goimports:
        machine:
          cpu: 1.5 # 1.5 CPU, 5760 MiB RAM
    

Resolving Dependencies

goimports may report false-positives if the dependencies are not found locally, so Inspecode resolves the dependencies in the same manner as go test. See the go test page for the details.

results matching ""

    No results matching ""