@@ -19,34 +19,21 @@ issues:
1919output :
2020 sort-results : true
2121
22- # Uncomment and add a path if needed to exclude
23- # skip-dirs:
24- # - some/path
25- # skip-files:
26- # - ".*\\.my\\.go$"
27- # - lib/bad.go
28-
2922# Find the whole list here https://golangci-lint.run/usage/linters/
3023linters :
3124 disable-all : true
3225 enable :
33- - deadcode # finds unused code
3426 - errcheck # checking for unchecked errors in go programs
3527 - errorlint # errorlint is a linter for that can be used to find code that will cause problems with the error wrapping scheme introduced in Go 1.13.
36- - goconst # finds repeated strings that could be replaced by a constant
37- - dupl # tool for code clone detection
3828 - forbidigo # forbids identifiers matched by reg exps
3929 - gomoddirectives # manage the use of 'replace', 'retract', and 'excludes' directives in go.mod.
4030 - gosimple # linter for Go source code that specializes in simplifying a code
4131 - misspell # finds commonly misspelled English words in comments
4232 - nakedret # finds naked returns in functions greater than a specified function length
43- - prealloc # finds slice declarations that could potentially be preallocated
4433 - nolintlint # reports ill-formed or insufficient nolint directives
4534 - staticcheck # Staticcheck is a go vet on steroids, applying a ton of static analysis checks
4635 - stylecheck # a replacement for golint
47- - unparam # reports unused function parameters
4836 - unused # checks Go code for unused constants, variables, functions and types
49-
5037 - govet # Vet examines Go source code and reports suspicious constructs, such as Printf calls whose arguments do not align with the format string
5138 - ineffassign # detects when assignments to existing variables are not used
5239 - structcheck # finds unused struct fields
@@ -63,15 +50,20 @@ linters:
6350 - noctx # noctx finds sending http request without context.Context
6451 - unconvert # Remove unnecessary type conversions
6552 - wastedassign # wastedassign finds wasted assignment statements.
66- - godox # tool for detection of FIXME, TODO and other comment keywords
6753 - gomodguard # check for blocked dependencies
6854
6955# all available settings of specific linters
7056linters-settings :
7157 errcheck :
7258 # report about not checking of errors in type assertions: `a := b.(MyStruct)`;
73- # default is false: such cases aren't reported by default.
7459 check-type-assertions : true
60+ # report about assignment of errors to blank identifier: `num, _ := strconv.Atoi(numStr)`.
61+ check-blank : false
62+ # List of functions to exclude from checking, where each entry is a single function to exclude.
63+ # See https://github.com/kisielk/errcheck#excluding-functions for details.
64+ exclude-functions :
65+ - (mapstr.M).Delete # Only returns ErrKeyNotFound, can safely be ignored.
66+ - (mapstr.M).Put # Can only fail on type conversions, usually safe to ignore.
7567
7668 errorlint :
7769 # Check whether fmt.Errorf uses the %w verb for formatting errors. See the readme for caveats
@@ -81,16 +73,6 @@ linters-settings:
8173 # Check for plain error comparisons
8274 comparison : true
8375
84- goconst :
85- # minimal length of string constant, 3 by default
86- min-len : 3
87- # minimal occurrences count to trigger, 3 by default
88- min-occurrences : 2
89-
90- dupl :
91- # tokens count to trigger issue, 150 by default
92- threshold : 100
93-
9476 forbidigo :
9577 # Forbid the following identifiers
9678 forbid :
@@ -106,30 +88,15 @@ linters-settings:
10688 # Select the Go version to target. The default is '1.13'.
10789 go : " 1.17.11"
10890
109- misspell :
110- # Correct spellings using locale preferences for US or UK.
111- # Default is to use a neutral variety of English.
112- # Setting locale to US will correct the British spelling of 'colour' to 'color'.
113- # locale: US
114- # ignore-words:
115- # - IdP
116-
11791 nakedret :
11892 # make an issue if func has more lines of code than this setting and it has naked returns; default is 30
11993 max-func-lines : 0
12094
121- prealloc :
122- # Report preallocation suggestions only on simple loops that have no returns/breaks/continues/gotos in them.
123- # True by default.
124- simple : true
125- range-loops : true # Report preallocation suggestions on range loops, true by default
126- for-loops : false # Report preallocation suggestions on for loops, false by default
127-
12895 nolintlint :
12996 # Enable to ensure that nolint directives are all used. Default is true.
13097 allow-unused : false
13198 # Disable to ensure that nolint directives don't have a leading space. Default is true.
132- allow-leading-space : true
99+ allow-leading-space : false
133100 # Exclude following linters from requiring an explanation. Default is [].
134101 allow-no-explanation : []
135102 # Enable to require an explanation of nonzero length after each nolint directive. Default is false.
@@ -147,7 +114,7 @@ linters-settings:
147114 recommendations :
148115 - errors
149116 - fmt
150- reason : " This package is deprecated"
117+ reason : " This package is deprecated, use fmt.Errorf with %%w instead "
151118 - github.com/elastic/beats/v7 :
152119 reason : " There must be no Beats dependency"
153120
@@ -163,13 +130,14 @@ linters-settings:
163130 # https://staticcheck.io/docs/options#checks
164131 checks : ["all"]
165132
166- unparam :
167- # Inspect exported functions, default is false. Set to true if no external program/library imports your code.
168- # XXX: if you enable this setting, unparam will report a lot of false-positives in text editors:
169- # if it's called for subdir of a project it can't find external interfaces. All text editor integrations
170- # with golangci-lint call it on a directory with the changed file.
171- check-exported : false
172-
173133 unused :
174134 # Select the Go version to target. The default is '1.13'.
175135 go : " 1.17.11"
136+
137+ gosec :
138+ excludes :
139+ - G306 # Expect WriteFile permissions to be 0600 or less
140+ - G404 # Use of weak random number generator
141+ - G401 # Detect the usage of DES, RC4, MD5 or SHA1: Used in non-crypto contexts.
142+ - G501 # Import blocklist: crypto/md5: Used in non-crypto contexts.
143+ - G505 # Import blocklist: crypto/sha1: Used in non-crypto contexts.
0 commit comments