Settings
gci
Check if code and import statements are formatted, with additional rules.
Since golangci-lint v1.30.0
Autofix
Repository
formatters:
settings:
gci:
# Section configuration to compare against.
# Section names are case-insensitive and may contain parameters in ().
# The default order of sections is `standard > default > custom > blank > dot > alias > localmodule`.
# If `custom-order` is `true`, it follows the order of `sections` option.
# Default: ["standard", "default"]
sections:
- standard # Standard section: captures all standard packages.
- default # Default section: contains all imports that could not be matched to another section type.
- prefix(github.com/org/project) # Custom section: groups all imports with the specified Prefix.
- blank # Blank section: contains all blank imports. This section is not present unless explicitly enabled.
- dot # Dot section: contains all dot imports. This section is not present unless explicitly enabled.
- alias # Alias section: contains all alias imports. This section is not present unless explicitly enabled.
- localmodule # Local module section: contains all local packages. This section is not present unless explicitly enabled.
# Checks that no inline comments are present.
# Default: false
no-inline-comments: true
# Checks that no prefix comments (comment lines above an import) are present.
# Default: false
no-prefix-comments: true
# Enable custom order of sections.
# If `true`, make the section order the same as the order of `sections`.
# Default: false
custom-order: true
# Drops lexical ordering for custom sections.
# Default: false
no-lex-order: true
gofmt
Check if the code is formatted according to 'gofmt' command.
Since golangci-lint v1.0.0
Autofix
Repository
formatters:
settings:
gofmt:
# Simplify code: gofmt with `-s` option.
# Default: true
simplify: false
# Apply the rewrite rules to the source before reformatting.
# https://pkg.go.dev/cmd/gofmt
# Default: []
rewrite-rules:
- pattern: 'interface{}'
replacement: 'any'
- pattern: 'a[b:len(a)]'
replacement: 'a[b:]'
gofumpt
Check if code and import statements are formatted, with additional rules.
Since golangci-lint v1.28.0
Autofix
Repository
formatters:
settings:
gofumpt:
# Module path which contains the source code being formatted.
# Default: ""
module-path: github.com/org/project
# Choose whether to use the extra rules.
# Default: false
extra-rules: true
goimports
Checks if the code and import statements are formatted according to the 'goimports' command.
Since golangci-lint v1.20.0
Autofix
Repository
formatters:
settings:
goimports:
# A list of prefixes, which, if set, checks import paths
# with the given prefixes are grouped after 3rd-party packages.
# Default: []
local-prefixes:
- github.com/org/project
golines
Checks if code is formatted, and fixes long lines.
Since golangci-lint v2.0.0
Autofix
Repository
formatters:
settings:
golines:
# Target maximum line length.
# Default: 100
max-len: 200
# Length of a tabulation.
# Default: 4
tab-len: 8
# Shorten single-line comments.
# Default: false
shorten-comments: true
# Default: true
reformat-tags: false
# Split chained methods on the dots as opposed to the arguments.
# Default: true
chain-split-dots: false
swaggo
Check if swaggo comments are formatted.
Since golangci-lint v2.2.0
Autofix
Repository
No settings available.
Last updated on