Command goimports updates your Go import lines, adding missing ones and removing unreferenced ones.
Patterns to include in execution and reports.
Patterns to exclude from execution and reports.
Specifying true implies
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.
Below is the list of options that are supported:
-local string put imports beginning with this string after 3rd-party packages; comma-separated list
No tool specific severity levels are available.
Note: The incremental analysis is not supported for goimports. This is because Inspecode always attempts to resolve external dependencies (by go get by default) and the results on unchanged files can be affected by the dependencies. See Resolving Dependencies about how the dependencies are resolved.
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
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.