Schema URL

Type: object

Properties

run object

Options for analysis running,

10 nested properties
concurrency integer

Number of concurrent runners. Defaults to the number of available CPU cores.

Examples: 4
min=0
timeout string

Timeout for the analysis.

Default: "1m"
Examples: "30s", "5m", "5m30s"
pattern=^((\d+h)?(\d+m)?(\d+(?:\.\d)?s)?|0)$
issues-exit-code integer

Exit code when at least one issue was found.

Default: 1
tests boolean

Enable inclusion of test files.

Default: true
build-tags string[]

List of build tags to pass to all linters.

Default:
[]
Examples: ["mytag"]
modules-download-mode enum

Option to pass to "go list -mod={option}". See "go help modules" for more information.

Values: "mod" "readonly" "vendor"
allow-parallel-runners boolean

Allow multiple parallel golangci-lint instances running. If disabled, golangci-lint acquires file lock on start.

Default: false
allow-serial-runners boolean

Allow multiple golangci-lint instances running, but serialize them around a lock.

Default: false
go string

Targeted Go version.

Default: "1.17"
relative-path-mode enum
Values: "gomod" "gitroot" "cfg" "wd"
output object

Output configuration options.

7 nested properties
formats object[]

Output formats to use.

print-issued-lines boolean

Print lines of code with issue.

Default: true
print-linter-name boolean

Print linter name in the end of issue text.

Default: true
path-prefix string

Add a prefix to the output file references.

Default: ""
show-stats boolean

Show statistics per linter.

Default: false
sort-order enum[]
sort-results boolean

Sort results by: filepath, line and column.

Default: true
linters-settings object

All available settings of specific linters.

85 nested properties
dupword object
2 nested properties
keywords string[]

Keywords for detecting duplicate words. If this list is not empty, only the words defined in this list will be detected.

uniqueItems=true
ignore string[]

Keywords used to ignore detection.

uniqueItems=true
asasalint object
3 nested properties
exclude string[]

To specify a set of function names to exclude.

uniqueItems=true
use-builtin-exclusions boolean

To enable/disable the asasalint builtin exclusions of function names.

Default: true
ignore-test boolean

Ignore *_test.go files.

Default: false
bidichk object
9 nested properties
left-to-right-embedding boolean

Disallow: LEFT-TO-RIGHT-EMBEDDING

Default: false
right-to-left-embedding boolean

Disallow: RIGHT-TO-LEFT-EMBEDDING

Default: false
pop-directional-formatting boolean

Disallow: POP-DIRECTIONAL-FORMATTING

Default: false
left-to-right-override boolean

Disallow: LEFT-TO-RIGHT-OVERRIDE

Default: false
right-to-left-override boolean

Disallow: RIGHT-TO-LEFT-OVERRIDE

Default: false
left-to-right-isolate boolean

Disallow: LEFT-TO-RIGHT-ISOLATE

Default: false
right-to-left-isolate boolean

Disallow: RIGHT-TO-LEFT-ISOLATE

Default: false
first-strong-isolate boolean

Disallow: FIRST-STRONG-ISOLATE

Default: false
pop-directional-isolate boolean

Disallow: POP-DIRECTIONAL-ISOLATE

Default: false
cyclop object
3 nested properties
skip-tests boolean

Should the linter execute on test files as well

Default: false
max-complexity integer

Max complexity the function can have

Default: 10
min=0
package-average number

Max average complexity in package

Default: 0
min=0
decorder object
8 nested properties
dec-order enum[]
Default:
[
  [
    "type",
    "const",
    "var",
    "func"
  ]
]
ignore-underscore-vars boolean

Underscore vars (vars with "_" as the name) will be ignored at all checks

Default: true
disable-dec-order-check boolean

Order of declarations is not checked

Default: true
disable-init-func-first-check boolean

Allow init func to be anywhere in file

Default: true
disable-dec-num-check boolean

Multiple global type, const and var declarations are allowed

Default: true
disable-type-dec-num-check boolean

Type declarations will be ignored for dec num check

Default: true
disable-const-dec-num-check boolean

Const declarations will be ignored for dec num check

Default: true
disable-var-dec-num-check boolean

Var declarations will be ignored for dec num check

Default: true
depguard object
1 nested properties
rules object

Rules to apply.

dogsled object
1 nested properties
max-blank-identifiers integer

Check assignments with too many blank identifiers.

Default: 2
min=0
dupl object
1 nested properties
threshold integer

Tokens count to trigger issue.

Default: 150
min=0
errcheck object
4 nested properties
check-type-assertions boolean

Report about not checking errors in type assertions, i.e.: a := b.(MyStruct)

Default: false
check-blank boolean

Report about assignment of errors to blank identifier

Default: false
exclude-functions string[]

List of functions to exclude from checking, where each entry is a single function to exclude

Examples: "io/ioutil.ReadFile", "io.Copy(*bytes.Buffer)"
disable-default-exclusions boolean

To disable the errcheck built-in exclude list

Default: false
errchkjson object
2 nested properties
check-error-free-encoding boolean
Default: false
report-no-exported boolean

Issue on struct that doesn't have exported fields.

Default: false
errorlint object
6 nested properties
errorf boolean

Check whether fmt.Errorf uses the %w verb for formatting errors

Default: true
errorf-multi boolean

Permit more than 1 %w verb, valid per Go 1.20

Default: true
asserts boolean

Check for plain type assertions and type switches.

Default: true
comparison boolean

Check for plain error comparisons

Default: true
allowed-errors object[]
allowed-errors-wildcard object[]
exhaustive object
9 nested properties
check string[]

Program elements to check for exhaustiveness.

uniqueItems=true
check-generated boolean

Check switch statements in generated files

Default: false
explicit-exhaustive-switch boolean

Only run exhaustive check on switches with "//exhaustive:enforce" comment.

Default: false
explicit-exhaustive-map boolean

Only run exhaustive check on map literals with "//exhaustive:enforce" comment.

Default: false
default-case-required boolean

Switch statement requires default case even if exhaustive.

Default: false
default-signifies-exhaustive boolean

Presence of default case in switch statements satisfies exhaustiveness, even if all enum members are not listed.

Default: false
ignore-enum-members string

Enum members matching regex do not have to be listed in switch statements to satisfy exhaustiveness

ignore-enum-types string

Enum types matching the supplied regex do not have to be listed in switch statements to satisfy exhaustiveness.

package-scope-only boolean

Consider enums only in package scopes, not in inner scopes.

Default: false
exhaustruct object
2 nested properties
include string[]

List of regular expressions to match struct packages and names.

Examples: ".*\.Test"
exclude string[]

List of regular expressions to exclude struct packages and names from check.

Examples: "cobra\.Command$"
fatcontext object
1 nested properties
check-struct-pointers boolean

Check for potential fat contexts in struct pointers.

Default: false
forbidigo object
3 nested properties
exclude-godoc-examples boolean

Exclude code in godoc examples.

Default: true
analyze-types boolean

Instead of matching the literal source code, use type information to replace expressions with strings that contain the package name and (for methods and fields) the type name.

Default: true
forbid string | object[]

List of identifiers to forbid (written using regexp)

Examples: "^print(ln)?$"
funlen object
3 nested properties
lines integer

Limit lines number per function.

Default: 60
statements integer

Limit statements number per function.

Default: 40
ignore-comments boolean

Ignore comments when counting lines.

Default: false
gci object
6 nested properties
sections enum | string[]

Section configuration to compare against.

Default:
[
  "standard",
  "default"
]
skip-generated boolean

Skip generated files.

Default: true
no-inline-comments boolean

Checks that no inline Comments are present.

Default: false
no-prefix-comments boolean

Checks that no prefix Comments(comment lines above an import) are present.

Default: false
custom-order boolean

Enable custom order of sections.

Default: false
no-lex-order boolean

Drops lexical ordering for custom sections.

Default: false
ginkgolinter object
12 nested properties
suppress-len-assertion boolean

Suppress the wrong length assertion warning.

Default: false
suppress-nil-assertion boolean

Suppress the wrong nil assertion warning.

Default: false
suppress-err-assertion boolean

Suppress the wrong error assertion warning.

Default: false
suppress-compare-assertion boolean

Suppress the wrong comparison assertion warning.

Default: false
suppress-async-assertion boolean

Suppress the function all in async assertion warning.

Default: false
suppress-type-compare-assertion boolean

Suppress warning for comparing values from different types, like int32 and uint32.

Default: false
forbid-focus-container boolean

Trigger warning for ginkgo focus containers like FDescribe, FContext, FWhen or FIt.

Default: false
allow-havelen-zero boolean

Don't trigger warnings for HaveLen(0).

Default: false
force-expect-to boolean

Force using Expect with To, ToNot or NotTo

Default: false
validate-async-intervals boolean

Best effort validation of async intervals (timeout and polling).

Default: false
forbid-spec-pollution boolean

Trigger a warning for variable assignments in ginkgo containers like Describe, Context and When, instead of in BeforeEach().

Default: false
force-succeed boolean

Force using the Succeed matcher for error functions, and the HaveOccurred matcher for non-function error values.

Default: false
gochecksumtype object
2 nested properties
default-signifies-exhaustive boolean

Presence of default case in switch statements satisfies exhaustiveness, if all members are not listed.

Default: true
include-shared-interfaces boolean

Include shared interfaces in the exhaustiviness check.

Default: false
gocognit object
1 nested properties
min-complexity integer

Minimal code complexity to report (we recommend 10-20).

Default: 30
goconst object
9 nested properties
match-constant boolean

Look for existing constants matching the values

Default: true
min-len integer

Minimum length of string constant.

Default: 3
min-occurrences integer

Minimum occurrences count to trigger.

Default: 3
ignore-tests boolean

Ignore test files.

Default: false
ignore-calls boolean

Ignore when constant is not used as function argument

Default: true
ignore-strings string

Exclude strings matching the given regular expression

numbers boolean

Search also for duplicated numbers.

Default: false
min integer

Minimum value, only works with numbers

Default: 3
max integer

Maximum value, only works with numbers

Default: 3
gocritic object
7 nested properties
enabled-checks gocritic-checks[]

Which checks should be enabled. By default, a list of stable checks is used. To see it, run GL_DEBUG=gocritic golangci-lint run.

disabled-checks gocritic-checks[]

Which checks should be disabled.

Default:
[]
enabled-tags gocritic-tags[]

Enable multiple checks by tags, run GL_DEBUG=gocritic golangci-lint run to see all tags and checks.

disabled-tags gocritic-tags[]

Disable multiple checks by tags, run GL_DEBUG=gocritic golangci-lint run to see all tags and checks.

settings object

Settings passed to gocritic. Properties must be valid and enabled check names.

13 nested properties
captLocal object
commentedOutCode object
elseif object
hugeParam object
ifElseChain object
nestingReduce object
rangeExprCopy object
rangeValCopy object
ruleguard object
tooManyResultsChecker object
truncateCmp object
underef object
unnamedResult object
disable-all boolean
Default: false
enable-all boolean
Default: false
gocyclo object
1 nested properties
min-complexity integer

Minimum code complexity to report (we recommend 10-20).

Default: 30
godot object
5 nested properties
scope enum

Comments to be checked.

Default: "declarations"
Values: "declarations" "toplevel" "all"
exclude string[]

List of regexps for excluding particular comment lines from check.

period boolean

Check that each sentence ends with a period.

Default: true
capital boolean

Check that each sentence starts with a capital letter.

Default: false
check-all boolean

DEPRECATED: Check all top-level comments, not only declarations.

Default: false
godox object
1 nested properties
keywords string[]

Report any comments starting with one of these keywords. This is useful for TODO or FIXME comments that might be left in the code accidentally and should be resolved before merging.

Default:
[
  "TODO",
  "BUG",
  "FIXME"
]
gofmt object
2 nested properties
simplify boolean

Simplify code.

Default: true
rewrite-rules object[]

Apply the rewrite rules to the source before reformatting.

interfacebloat object
1 nested properties
max integer

The maximum number of methods allowed for an interface.

gofumpt object
2 nested properties
extra-rules boolean

Choose whether or not to use the extra rules that are disabled by default.

Default: false
module-path string

Module path which contains the source code being formatted.

goheader object
One of: variant, variant
3 nested properties
values object
2 nested properties
const object

Constants to use in the template.

Examples: {"YEAR":"2030","COMPANY":"MY FUTURISTIC COMPANY"}
regexp object

Regular expressions to use in your template.

Examples: {"AUTHOR":".*@mycompany\\.com"}
template string

Template to put on top of every file.

Examples: "{{ MY COMPANY }} SPDX-License-Identifier: Apache-2.0 Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at: http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License."
template-path string

Path to the file containing the template source.

Examples: "my_header_template.txt"
goimports object
1 nested properties
local-prefixes string

Put imports beginning with prefix after 3rd-party packages. It is a comma-separated list of prefixes.

Examples: "github.com/org/project"
gomoddirectives object
9 nested properties
replace-local boolean

Allow local replace directives.

Default: true
replace-allow-list string[]

List of allowed replace directives.

retract-allow-no-explanation boolean

Allow to not explain why the version has been retracted in the retract directives.

Default: false
exclude-forbidden boolean

Forbid the use of the exclude directives.

Default: false
toolchain-forbidden boolean

Forbid the use of the toolchain directive.

Default: false
toolchain-pattern string

Defines a pattern to validate toolchain directive.

tool-forbidden boolean

Forbid the use of the tool directives.

Default: false
go-debug-forbidden boolean

Forbid the use of the godebug directive.

Default: false
go-version-pattern string

Defines a pattern to validate go minimum version directive.

Default: ""
gomodguard object
2 nested properties
allowed object
2 nested properties
modules string[]

List of allowed modules.

domains string[]

List of allowed module domains.

blocked object
3 nested properties
modules object[]

List of blocked modules.

versions object[]

List of blocked module version constraints.

local_replace_directives boolean

Raise lint issues if loading local path with replace directive

Default: true
gosimple object
1 nested properties
checks enum | string[]
gosec object
7 nested properties
includes gosec-rules[]

To select a subset of rules to run

Examples: ["G401"]
excludes gosec-rules[]

To specify a set of rules to explicitly exclude

Examples: ["G401"]
exclude-generated boolean

Exclude generated files

Default: false
severity string

Filter out the issues with a lower severity than the given value

Default: "low"
Values: "low" "medium" "high"
confidence string

Filter out the issues with a lower confidence than the given value

Default: "low"
Values: "low" "medium" "high"
config object

To specify the configuration of rules

concurrency integer

Concurrency value

gosmopolitan object
4 nested properties
allow-time-local boolean

Allow and ignore time.Local usages.

Default: false
escape-hatches string[]

List of fully qualified names in the full/pkg/path.name form, to act as "i18n escape hatches".

ignore-tests boolean

Ignore test files.

Default: false
watch-for-scripts string[]

List of Unicode scripts to watch for any usage in string literals.

govet object
5 nested properties
settings object

Settings per analyzer. Map of analyzer name to specific settings. Run go tool vet help to find out more.

Enable analyzers by name.

Disable analyzers by name.

enable-all boolean

Enable all analyzers.

Default: false
disable-all boolean

Disable all analyzers.

Default: false
grouper object
8 nested properties
const-require-single-const boolean
Default: false
const-require-grouping boolean
Default: false
import-require-single-import boolean
Default: false
import-require-grouping boolean
Default: false
type-require-single-type boolean
Default: false
type-require-grouping boolean
Default: false
var-require-single-var boolean
Default: false
var-require-grouping boolean
Default: false
iface object
2 nested properties

Enable analyzers by name.

settings object
1 nested properties
unused object
importas object
3 nested properties
no-unaliased boolean

Do not allow unaliased imports of aliased packages.

Default: false
no-extra-aliases boolean

Do not allow non-required aliases.

Default: false
alias object[]

List of aliases

inamedparam object
1 nested properties
skip-single-param boolean

Skips check for interface methods with only a single parameter.

Default: false
ireturn object

Use either reject or allow properties for interfaces matching.

Any of: variant, variant
2 nested properties
allow string | enum[]
reject string | enum[]
lll object
2 nested properties
tab-width integer

Width of "\t" in spaces.

Default: 1
min=0
line-length integer

Maximum allowed line length, lines longer will be reported.

Default: 120
min=1
makezero object
1 nested properties
always boolean

Allow only slices initialized with a length of zero.

Default: false
loggercheck object
8 nested properties
kitlog boolean

Allow check for the github.com/go-kit/log library.

Default: true
klog boolean

Allow check for the k8s.io/klog/v2 library.

Default: true
logr boolean

Allow check for the github.com/go-logr/logr library.

Default: true
slog boolean

Allow check for the log/slog library.

Default: true
zap boolean

Allow check for the "sugar logger" from go.uber.org/zap library.

Default: true
require-string-key boolean

Require all logging keys to be inlined constant strings.

Default: false
no-printf-like boolean

Require printf-like format specifier (%s, %d for example) not present.

Default: false
rules string[]

List of custom rules to check against, where each rule is a single logger pattern, useful for wrapped loggers.

misspell object

Correct spellings using locale preferences for US or UK. Default is to use a neutral variety of English.

4 nested properties
locale enum
Values: "US" "UK"
ignore-words string[]

List of words to ignore.

mode enum

Mode of the analysis.

Default: ""
Values: "restricted" "" "default"
extra-words object[]

Extra word corrections.

musttag object
1 nested properties
functions object[]
nakedret object
1 nested properties
max-func-lines integer

Report if a function has more lines of code than this value and it has naked returns.

Default: 30
min=0
nestif object
1 nested properties
min-complexity integer

Minimum complexity of "if" statements to report.

Default: 5
nilnil object
2 nested properties
detect-opposite boolean

In addition, detect opposite situation (simultaneous return of non-nil error and valid value).

Default: false
checked-types enum[]

List of return types to check.

Default:
[
  "chan",
  "func",
  "iface",
  "map",
  "ptr",
  "uintptr",
  "unsafeptr"
]
nlreturn object
1 nested properties
block-size number

set block size that is still ok

Default: 0
min=0
mnd object
4 nested properties
ignored-files string[]

List of file patterns to exclude from analysis.

Examples: ["magic1_.*.go"]
ignored-functions string[]

Comma-separated list of function patterns to exclude from the analysis.

Examples: ["math.*","http.StatusText","make"]
ignored-numbers string[]

List of numbers to exclude from analysis.

Examples: ["1000","1234_567_890","3.14159264"]
checks enum[]

The list of enabled checks, see https://github.com/tommy-muehle/go-mnd/#checks for description.

nolintlint object
4 nested properties
allow-unused boolean

Enable to ensure that nolint directives are all used.

Default: true
allow-no-explanation linters[]

Exclude these linters from requiring an explanation.

Default:
[]
require-explanation boolean

Enable to require an explanation of nonzero length after each nolint directive.

Default: false
require-specific boolean

Enable to require nolint directives to mention the specific linter being suppressed.

Default: false
reassign object
1 nested properties
patterns string[]
recvcheck object
2 nested properties
disable-builtin boolean

Disables the built-in method exclusions.

Default: true
exclusions string[]

User-defined method exclusions.

nonamedreturns object
1 nested properties
report-error-in-defer boolean

Report named error if it is assigned inside defer.

Default: false
paralleltest object
2 nested properties
ignore-missing boolean

Ignore missing calls to t.Parallel() and only report incorrect uses of it.

Default: false
ignore-missing-subtests boolean

Ignore missing calls to t.Parallel() in subtests. Top-level tests are still required to have t.Parallel, but subtests are allowed to skip it.

Default: false
perfsprint object
10 nested properties
integer-format boolean

Enable/disable optimization of integer formatting.

Default: true
int-conversion boolean

Optimizes even if it requires an int or uint type cast.

Default: true
error-format boolean

Enable/disable optimization of error formatting.

Default: true
err-error boolean

Optimizes into err.Error() even if it is only equivalent for non-nil errors.

Default: false
errorf boolean

Optimizes fmt.Errorf.

Default: true
string-format boolean

Enable/disable optimization of string formatting.

Default: true
sprintf1 boolean

Optimizes fmt.Sprintf with only one argument.

Default: true
strconcat boolean

Optimizes into strings concatenation.

Default: true
bool-format boolean

Enable/disable optimization of bool formatting.

Default: true
hex-format boolean

Enable/disable optimization of hex formatting.

Default: true
prealloc object

We do not recommend using this linter before doing performance profiling. For most programs usage of prealloc will be premature optimization.

3 nested properties
simple boolean

Report preallocation suggestions only on simple loops that have no returns/breaks/continues/gotos in them.

Default: true
range-loops boolean

Report preallocation suggestions on range loops.

Default: true
for-loops boolean

Report preallocation suggestions on for loops.

Default: false
predeclared object
2 nested properties
ignore string

Comma-separated list of predeclared identifiers to not report on.

q boolean

Include method names and field names (i.e., qualified names) in checks.

Default: false
promlinter object
2 nested properties
strict
disabled-linters enum[]
protogetter object
4 nested properties
skip-generated-by string[]
skip-files string[]
skip-any-generated boolean

Skip any generated files from the checking.

Default: false
replace-first-arg-in-append boolean

Skip first argument of append function.

Default: false
revive object
Examples: {"ignore-generated-header":true,"severity":"warning","rules":[{"name":"indent-error-flow","severity":"warning"},{"name":"add-constant","severity":"warning","arguments":[{"maxLitCount":"3","allowStrs":"\"\"","allowInts":"0,1,2","allowFloats":"0.0,0.,1.0,1.,2.0,2."}]}]}
7 nested properties
max-open-files integer
ignore-generated-header boolean
confidence number
severity string
Values: "warning" "error"
enable-all-rules boolean
Default: false
directives object[]
rules object[]
rowserrcheck object
1 nested properties
packages string[]
sloglint object
10 nested properties
kv-only boolean

Enforce using key-value pairs only (incompatible with attr-only).

Default: false
no-global enum

Enforce not using global loggers.

Default: ""
Values: "" "all" "default"
no-mixed-args boolean

Enforce not mixing key-value pairs and attributes.

Default: true
context enum

Enforce using methods that accept a context.

Default: ""
Values: "" "all" "scope"
static-msg boolean

Enforce using static values for log messages.

Default: false
key-naming-case enum

Enforce a single key naming convention.

Values: "snake" "kebab" "camel" "pascal"
attr-only boolean

Enforce using attributes only (incompatible with kv-only).

Default: false
no-raw-keys boolean

Enforce using constants instead of raw keys.

Default: false
forbidden-keys string[]

Enforce not using specific keys.

args-on-sep-lines boolean

Enforce putting arguments on separate lines.

Default: false
spancheck object
3 nested properties
checks enum[]

Checks to enable.

ignore-check-signatures string[]

A list of regexes for function signatures that silence record-error and set-status reports if found in the call path to a returned error.

extra-start-span-signatures string[]

A list of regexes for additional function signatures that create spans.

staticcheck object
1 nested properties
checks enum | string[]
stylecheck object
4 nested properties
checks enum | string[]
Default:
[
  "all",
  "-ST1000",
  "-ST1003",
  "-ST1016",
  "-ST1020",
  "-ST1021",
  "-ST1022"
]
dot-import-whitelist string[]

By default, ST1001 forbids all uses of dot imports in non-test packages. This setting allows setting a whitelist of import paths that can be dot-imported anywhere.

http-status-code-whitelist enum[]

ST1013 recommends using constants from the net/http package instead of hard-coding numeric HTTP status codes. This setting specifies a list of numeric status codes that this check does not complain about.

Default:
[
  "200",
  "400",
  "404",
  "500"
]
initialisms string[]

ST1003 check, among other things, for the correct capitalization of initialisms. The set of known initialisms can be configured with this option.

tagalign object
4 nested properties
align boolean

Align and sort can be used together or separately.

Default: true
sort boolean

Whether enable tags sort.

Default: true
order string[]

Specify the order of tags, the other tags will be sorted by name.

Default:
[]
Examples: ["json","yaml","yml","toml","mapstructure","binding","validate"]
strict boolean

Whether enable strict style.

Default: false
tagliatelle object
1 nested properties
case object
5 nested properties
use-field-name boolean

Use the struct field name to check the name of the struct tag.

Default: false
ignored-fields string[]

The field names to ignore.

rules object
extended-rules object

Defines the association between tag name and case.

overrides object[]

Overrides the default/root configuration.

tenv object
1 nested properties
all boolean

The option all will run against whole test files (_test.go) regardless of method/function signatures.

Default: false
testifylint object
10 nested properties
enable-all boolean

Enable all checkers.

Default: false
disable-all boolean

Disable all checkers.

Default: false
enable enum[]

Enable specific checkers.

Default:
[
  "blank-import",
  "bool-compare",
  "compares",
  "contains",
  "empty",
  "encoded-compare",
  "error-is-as",
  "error-nil",
  "expected-actual",
  "float-compare",
  "formatter",
  "go-require",
  "len",
  "negative-positive",
  "nil-compare",
  "regexp",
  "require-error",
  "suite-broken-parallel",
  "suite-dont-use-pkg",
  "suite-extra-assert-call",
  "suite-subtest-run",
  "useless-assert"
]
disable enum[]

Disable specific checkers.

bool-compare object
1 nested properties
ignore-custom-types boolean

To ignore user defined types (over builtin bool).

Default: false
expected-actual object
1 nested properties
pattern string

Regexp for expected variable name.

Default: "(^(exp(ected)?|want(ed)?)([A-Z]\w*)?$)|(^(\w*[a-z])?(Exp(ected)?|Want(ed)?)$)"
formatter object
2 nested properties
check-format-string boolean

To enable go vet's printf checks.

Default: true
require-f-funcs boolean

To require f-assertions (e.g. assert.Equalf) if format string is used, even if there are no variable-length variables.

Default: false
go-require object
1 nested properties
ignore-http-handlers boolean

To ignore HTTP handlers (like http.HandlerFunc).

Default: false
require-error object
1 nested properties
fn-pattern string

Regexp for assertions to analyze. If defined, then only matched error assertions will be reported.

Default: ""
suite-extra-assert-call object
1 nested properties
mode string

To require or remove extra Assert() call?

Default: "remove"
Values: "remove" "require"
testpackage object
2 nested properties
skip-regexp string

Files with names matching this regular expression are skipped.

Examples: "(export|internal)_test\.go"
allow-packages string[]

List of packages that don't end with _test that tests are allowed to be in.

uniqueItems=true
thelper object
4 nested properties
test object
3 nested properties
begin boolean

Check if t.Helper() begins helper function.

Default: true
first boolean

Check if *testing.T is first param of helper function.

Default: true
name boolean

Check if *testing.T param has t name.

Default: true
benchmark object
3 nested properties
begin boolean

Check if b.Helper() begins helper function.

Default: true
first boolean

Check if *testing.B is first param of helper function.

Default: true
name boolean

Check if *testing.B param has b name.

Default: true
tb object
3 nested properties
begin boolean

Check if tb.Helper() begins helper function.

Default: true
first boolean

Check if *testing.TB is first param of helper function.

Default: true
name boolean

Check if *testing.TB param has tb name.

Default: true
fuzz object
3 nested properties
begin boolean

Check if f.Helper() begins helper function.

Default: true
first boolean

Check if *testing.F is first param of helper function.

Default: true
name boolean

Check if *testing.F param has f name.

Default: true
usestdlibvars object
10 nested properties
http-method boolean

Suggest the use of http.MethodXX.

Default: true
http-status-code boolean

Suggest the use of http.StatusXX.

Default: true
time-weekday boolean

Suggest the use of time.Weekday.String().

Default: false
time-month boolean

Suggest the use of time.Month.String().

Default: false
time-layout boolean

Suggest the use of time.Layout.

Default: false
crypto-hash boolean

Suggest the use of crypto.Hash.String().

Default: false
default-rpc-path boolean

Suggest the use of rpc.DefaultXXPath.

Default: false
sql-isolation-level boolean

Suggest the use of sql.LevelXX.String().

Default: false
tls-signature-scheme boolean

Suggest the use of tls.SignatureScheme.String().

Default: false
constant-kind boolean

Suggest the use of constant.Kind.String().

Default: false
usetesting object
7 nested properties
context-background boolean
Default: true
context-todo boolean
Default: true
os-chdir boolean
Default: true
os-mkdir-temp boolean
Default: true
os-setenv boolean
Default: true
os-create-temp boolean
Default: true
os-temp-dir boolean
Default: false
unconvert object
2 nested properties
fast-math boolean
Default: false
safe boolean
Default: false
unparam object
1 nested properties
check-exported boolean

Inspect exported functions. Set to true if no external program/library imports your code.

WARNING: if you enable this setting, unparam will report a lot of false-positives in text editors: if it's called for subdir of a project it can't find external interfaces. All text editor integrations with golangci-lint call it on a directory with the changed file.

Default: false
unused object
6 nested properties
field-writes-are-uses boolean
Default: true
post-statements-are-reads boolean
Default: false
exported-fields-are-used boolean
Default: true
parameters-are-used boolean
Default: true
local-variables-are-used boolean
Default: true
generated-is-used boolean
Default: true
varnamelen object
10 nested properties
max-distance integer

Variables used in at most this N-many lines will be ignored.

Default: 5
min-name-length integer

The minimum length of a variable's name that is considered long.

Default: 3
check-receiver boolean

Check method receiver names.

Default: false
check-return boolean

Check named return values.

Default: false
check-type-param boolean

Check type parameters.

Default: false
ignore-type-assert-ok boolean

Ignore ok variables that hold the bool return value of a type assertion

Default: false
ignore-map-index-ok boolean

Ignore ok variables that hold the bool return value of a map index.

Default: false
ignore-chan-recv-ok boolean

Ignore ok variables that hold the bool return value of a channel receive.

Default: false
ignore-names string[]

Optional list of variable names that should be ignored completely.

Default:
[
  []
]
ignore-decls string[]

Optional list of variable declarations that should be ignored completely.

Examples: ["c echo.Context","t testing.T","f *foo.Bar","const C"]
whitespace object
2 nested properties
multi-if boolean

Enforces newlines (or comments) after every multi-line if statement

Default: false
multi-func boolean

Enforces newlines (or comments) after every multi-line function signature

Default: false
wrapcheck object
5 nested properties
extra-ignore-sigs string[]

An array of strings specifying additional substrings of signatures to ignore.

Default:
[
  ".CustomError(",
  ".SpecificWrap("
]
ignoreSigs string[]

An array of strings which specify substrings of signatures to ignore.

Default:
[
  ".Errorf(",
  "errors.New(",
  "errors.Unwrap(",
  ".Wrap(",
  ".Wrapf(",
  ".WithMessage(",
  ".WithMessagef(",
  ".WithStack("
]
ignoreSigRegexps string[]

An array of strings which specify regular expressions of signatures to ignore.

Default:
[
  ""
]
ignorePackageGlobs string[]

An array of glob patterns which, if any match the package of the function returning the error, will skip wrapcheck analysis for this error.

Default:
[
  ""
]
ignoreInterfaceRegexps string[]

An array of glob patterns which, if matched to an underlying interface name, will ignore unwrapped errors returned from a function whose call is defined on the given interface.

Default:
[
  ""
]
wsl object
13 nested properties
allow-assign-and-anything boolean

Controls if you may cuddle assignments and anything without needing an empty line between them.

Default: false
allow-assign-and-call boolean

Allow calls and assignments to be cuddled as long as the lines have any matching variables, fields or types.

Default: true
allow-cuddle-declarations boolean

Allow declarations (var) to be cuddled.

Default: false
allow-cuddle-with-calls string[]

A list of call idents that everything can be cuddled with.

allow-cuddle-with-rhs string[]

AllowCuddleWithRHS is a list of right hand side variables that is allowed to be cuddled with anything.

allow-multiline-assign boolean

Allow multiline assignments to be cuddled.

Default: true
allow-separated-leading-comment boolean

Allow leading comments to be separated with empty lines.

Default: false
allow-trailing-comment boolean

Allow trailing comments in ending of blocks.

Default: false
error-variable-names string[]

When force-err-cuddling is enabled this is a list of names used for error variables to check for in the conditional.

force-case-trailing-whitespace integer

Force newlines in end of case at this limit (0 = never).

Default: 0
min=0
force-err-cuddling boolean

Causes an error when an If statement that checks an error variable doesn't cuddle with the assignment of that variable.

Default: false
force-short-decl-cuddling boolean

Causes an error if a short declaration (:=) cuddles with anything other than another short declaration.

Default: false
strict-append boolean

If true, append is only allowed to be cuddled if appending value is matching variables, fields or types on line above.

Default: true
copyloopvar object
1 nested properties
check-alias boolean
Default: false
custom object

The custom section can be used to define linter plugins to be loaded at runtime. See README of golangci-lint for more information. Each custom linter should have a unique name.

linters object
7 nested properties
enable linters[]

List of enabled linters.

disable linters[]

List of disabled linters.

enable-all boolean

Whether to enable all linters. You can re-disable them with disable explicitly.

Default: false
disable-all boolean

Whether to disable all linters. You can re-enable them with enable explicitly.

Default: false
presets enum[]

Allow to use different presets of linters

fast boolean

Enable run of fast linters.

Default: false
exclusions object
6 nested properties
generated enum
Default: "lax"
Values: "strict" "lax" "disable"
warn-unused boolean
Default: false
default enum[]
rules object[]
paths string[]
paths-except string[]
issues object
18 nested properties
exclude string[]

List of regular expressions of issue texts to exclude. But independently from this option we use default exclude patterns. Their usage can be controlled through exclude-use-default.

exclude-rules object[]

Exclude configuration per-path, per-linter, per-text and per-source

exclude-use-default boolean

Independently from option exclude we use default exclude patterns. This behavior can be disabled by this option.

Default: true
exclude-case-sensitive boolean

If set to true, exclude and exclude-rules regular expressions become case sensitive.

Default: false
exclude-generated enum

Mode of the generated files analysis.

Default: "lax"
Values: "lax" "strict" "disable"
exclude-dirs string[]

Which directories to exclude: issues from them won't be reported.

Default:
[]
Examples: ["src/external_libs","autogenerated_by_my_lib"]
exclude-dirs-use-default boolean

Enable exclusion of directories "vendor", "third_party", "testdata", "examples", "Godeps", and "builtin".

Default: true
exclude-files string[]

Which files to exclude: they will be analyzed, but issues from them will not be reported.

Default:
[]
Examples: [".*\\.my\\.go$","lib/bad.go"]
include enum[]

The list of ids of default excludes to include or disable.

Default:
[]
max-issues-per-linter integer

Maximum issues count per one linter. Set to 0 to disable.

Default: 50
min=0
max-same-issues integer

Maximum count of issues with the same text. Set to 0 to disable.

Default: 3
min=0
new boolean

Show only new issues: if there are unstaged changes or untracked files, only those changes are analyzed, else only changes in HEAD~ are analyzed.

Default: false
new-from-merge-base string

Show only new issues created after the best common ancestor (merge-base against HEAD).

new-from-rev string

Show only new issues created after this git revision.

new-from-patch string

Show only new issues created in git patch with this file path.

Examples: "path/to/patch/file"
fix boolean

Fix found issues (if it's supported by the linter).

Default: false
uniq-by-line boolean

Make issues output unique by line.

Default: true
whole-files boolean

Show issues in any part of update files (requires new-from-rev or new-from-patch).

Default: false
severity object
3 nested properties
default-severity string required

Set the default severity for issues. If severity rules are defined and the issues do not match or no severity is provided to the rule this will be the default severity applied. Severities should match the supported severity names of the selected out format.

Default: ""
case-sensitive boolean

If set to true, severity-rules regular expressions become case sensitive.

Default: false
rules object[]

When a list of severity rules are provided, severity information will be added to lint issues. Severity rules have the same filtering capability as exclude rules except you are allowed to specify one matcher per severity rule. Only affects out formats that support setting severity information.

Default:
[]

Definitions

gocritic-checks enum
gocritic-tags enum
gosec-rules enum
govet-analyzers enum
revive-rules enum
iface-analyzers enum
tagliatelle-cases enum
linters enum | string

Linters usable.

relative-path-modes enum