Skip to content

Commit 05e0f47

Browse files
authored
Merge pull request #94 from cpanato/updates
bump golangci-lint to 1.55.1 and ko to 0.15.0
2 parents ff2d69b + ec79463 commit 05e0f47

File tree

13 files changed

+145
-94
lines changed

13 files changed

+145
-94
lines changed

.golangci.yml

Lines changed: 95 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
run:
33
concurrency: 6
4-
deadline: 5m
4+
timeout: 5m
55
issues:
66
exclude-rules:
77
# counterfeiter fakes are usually named 'fake_<something>.go'
@@ -10,22 +10,31 @@ issues:
1010
- gocritic
1111
- golint
1212
- dupl
13+
14+
# Maximum issues count per one linter. Set to 0 to disable. Default is 50.
15+
max-issues-per-linter: 0
16+
17+
# Maximum count of issues with the same text. Set to 0 to disable. Default is 3.
18+
max-same-issues: 0
1319
linters:
1420
disable-all: true
1521
enable:
1622
- asasalint
1723
- asciicheck
1824
- bidichk
1925
- bodyclose
20-
- containedctx
2126
- contextcheck
2227
- decorder
2328
- dogsled
2429
- dupl
2530
- durationcheck
2631
- errcheck
2732
- errchkjson
33+
- errname
2834
- execinquery
35+
- ginkgolinter
36+
- gocheckcompilerdirectives
37+
- gochecksumtype
2938
- goconst
3039
- gocritic
3140
- gocyclo
@@ -37,37 +46,47 @@ linters:
3746
- gomoddirectives
3847
- gomodguard
3948
- goprintffuncname
49+
- gosec
4050
- gosimple
51+
- gosmopolitan
4152
- govet
4253
- grouper
4354
- importas
4455
- ineffassign
45-
- interfacebloat
46-
- ireturn
47-
- logrlint
48-
- maintidx
56+
- loggercheck
4957
- makezero
58+
- mirror
5059
- misspell
60+
- musttag
5161
- nakedret
52-
- nilnil
62+
- nolintlint
5363
- nosprintfhostport
64+
- perfsprint
5465
- prealloc
5566
- predeclared
5667
- promlinter
68+
- protogetter
5769
- reassign
70+
- revive
5871
- rowserrcheck
72+
- sloglint
5973
- sqlclosecheck
6074
- staticcheck
6175
- stylecheck
76+
- tagalign
6277
- tenv
78+
- testableexamples
6379
- typecheck
6480
- unconvert
6581
- unparam
6682
- unused
6783
- usestdlibvars
6884
- whitespace
85+
- zerologlint
86+
# - containedctx
6987
# - cyclop
70-
# - errname
88+
# - depguard
89+
# - dupword
7190
# - errorlint
7291
# - exhaustive
7392
# - exhaustruct
@@ -82,16 +101,19 @@ linters:
82101
# - godot
83102
# - goerr113
84103
# - gomnd
85-
# - gosec
104+
# - inamedparam
105+
# - interfacebloat
106+
# - ireturn
86107
# - lll
108+
# - maintidx
87109
# - nestif
88110
# - nilerr
111+
# - nilnil
89112
# - nlreturn
90113
# - noctx
91-
# - nolintlint
92114
# - nonamedreturns
93115
# - paralleltest
94-
# - revive
116+
# - testifylint
95117
# - tagliatelle
96118
# - testpackage
97119
# - thelper
@@ -101,6 +123,8 @@ linters:
101123
# - wrapcheck
102124
# - wsl
103125
linters-settings:
126+
gocyclo:
127+
min-complexity: 40
104128
godox:
105129
keywords:
106130
- BUG
@@ -111,114 +135,119 @@ linters-settings:
111135
check-blank: true
112136
gocritic:
113137
enabled-checks:
114-
# Diagnostic
115138
- appendAssign
139+
- appendCombine
116140
- argOrder
141+
- assignOp
117142
- badCall
118143
- badCond
119144
- badLock
120145
- badRegexp
121146
- badSorting
147+
- boolExprSimplify
148+
- builtinShadow
122149
- builtinShadowDecl
150+
- captLocal
123151
- caseOrder
124152
- codegenComment
153+
- commentFormatting
125154
- commentedOutCode
155+
- commentedOutImport
156+
- defaultCaseOrder
126157
- deferInLoop
158+
- deferUnlambda
127159
- deprecatedComment
160+
- docStub
128161
- dupArg
129162
- dupBranchBody
130163
- dupCase
164+
- dupImport
131165
- dupSubExpr
132166
- dynamicFmtString
167+
- elseif
133168
- emptyDecl
169+
- emptyFallthrough
170+
- emptyStringTest
171+
- equalFold
134172
- evalOrder
135173
- exitAfterDefer
174+
- exposedSyncMutex
136175
- externalErrorReassign
137176
- filepathJoin
138177
- flagDeref
139178
- flagName
179+
- hexLiteral
180+
- httpNoBody
181+
- hugeParam
182+
- ifElseChain
183+
- importShadow
184+
- indexAlloc
185+
- initClause
140186
- mapKey
187+
- methodExprCall
188+
- nestingReduce
189+
- newDeref
141190
- nilValReturn
191+
- octalLiteral
142192
- offBy1
143-
- regexpPattern
144-
- returnAfterHttpError
145-
- sloppyReassign
146-
- sloppyTypeAssert
147-
- sortSlice
148-
- sprintfQuotedString
149-
- sqlQuery
150-
- syncMapLoadAndDelete
151-
- truncateCmp
152-
- unnecessaryDefer
153-
- weakCond
154-
155-
# Performance
156-
- appendCombine
157-
- equalFold
158-
- hugeParam
159-
- indexAlloc
193+
- paramTypeCombine
160194
- preferDecodeRune
195+
- preferFilepathJoin
161196
- preferFprint
162197
- preferStringWriter
163198
- preferWriteByte
199+
- ptrToRefParam
164200
- rangeExprCopy
165201
- rangeValCopy
166-
- sliceClear
167-
- stringXbytes
168-
169-
# Style
170-
- assignOp
171-
- boolExprSimplify
172-
- captLocal
173-
- commentFormatting
174-
- commentedOutImport
175-
- defaultCaseOrder
176-
- deferUnlambda
177-
- docStub
178-
- dupImport
179-
- elseif
180-
- emptyFallthrough
181-
- emptyStringTest
182-
- exposedSyncMutex
183-
- hexLiteral
184-
- httpNoBody
185-
- ifElseChain
186-
- methodExprCall
187-
- newDeref
188-
- octalLiteral
189-
- preferFilepathJoin
190202
- redundantSprint
191203
- regexpMust
204+
- regexpPattern
192205
- regexpSimplify
206+
- returnAfterHttpError
193207
- ruleguard
194208
- singleCaseSwitch
209+
- sliceClear
195210
- sloppyLen
211+
- sloppyReassign
212+
- sloppyTypeAssert
213+
- sortSlice
214+
- sprintfQuotedString
215+
- sqlQuery
196216
- stringConcatSimplify
217+
- stringXbytes
197218
- stringsCompare
198219
- switchTrue
220+
- syncMapLoadAndDelete
199221
- timeCmpSimplify
200222
- timeExprSimplify
201-
- todoCommentWithoutDetail
202223
- tooManyResultsChecker
224+
- truncateCmp
203225
- typeAssertChain
204226
- typeDefFirst
205227
- typeSwitchVar
228+
- typeUnparen
229+
- uncheckedInlineErr
206230
- underef
207231
- unlabelStmt
208232
- unlambda
233+
- unnamedResult
234+
- unnecessaryBlock
235+
- unnecessaryDefer
209236
- unslice
210237
- valSwap
238+
- weakCond
211239
- wrapperFunc
212240
- yodaStyleExpr
213-
# - whyNoLint
214-
215-
# Opinionated
216-
- builtinShadow
217-
- importShadow
218-
- initClause
219-
- nestingReduce
220-
- paramTypeCombine
221-
- ptrToRefParam
222-
- typeUnparen
223-
- unnamedResult
224-
- unnecessaryBlock
241+
nolintlint:
242+
# Enable to ensure that nolint directives are all used. Default is true.
243+
allow-unused: false
244+
# Disable to ensure that nolint directives don't have a leading space. Default is true.
245+
# TODO(lint): Enforce machine-readable `nolint` directives
246+
allow-leading-space: true
247+
# Exclude following linters from requiring an explanation. Default is [].
248+
allow-no-explanation: []
249+
# Enable to require an explanation of nonzero length after each nolint directive. Default is false.
250+
# TODO(lint): Enforce explanations for `nolint` directives
251+
require-explanation: false
252+
# Enable to require nolint directives to mention the specific linter being suppressed. Default is false.
253+
require-specific: true

command/command.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ type Status struct {
5858
}
5959

6060
// Stream combines standard output and error
61-
type Stream struct {
61+
type Stream struct { //nolint: errname
6262
stdOut string
6363
stdErr string
6464
}
@@ -195,7 +195,7 @@ func (c *Command) RunSuccessOutput() (output *Stream, err error) {
195195
// RunSuccess starts the command and waits for it to finish. It returns an
196196
// error if the command execution was not successful.
197197
func (c *Command) RunSuccess() error {
198-
_, err := c.RunSuccessOutput() // nolint: errcheck
198+
_, err := c.RunSuccessOutput() //nolint: errcheck
199199
return err
200200
}
201201

@@ -242,7 +242,7 @@ func (c *Command) RunSilentSuccessOutput() (output *Stream, err error) {
242242
// an error if the command execution was not successful. This method does not
243243
// print the output of the command during its execution.
244244
func (c *Command) RunSilentSuccess() error {
245-
_, err := c.RunSilentSuccessOutput() // nolint: errcheck
245+
_, err := c.RunSilentSuccessOutput() //nolint: errcheck
246246
return err
247247
}
248248

command/global.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ var atomicInt int32
2626

2727
// SetGlobalVerbose sets the global command verbosity to the specified value
2828
func SetGlobalVerbose(to bool) {
29-
var i int32 = 0
29+
var i int32
3030
if to {
3131
i = 1
3232
}

dependencies.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
dependencies:
22
# golangci/golangci-lint
33
- name: "golangci-lint"
4-
version: 1.54.2
4+
version: 1.55.1
55
refPaths:
6-
- path: mage/golang.go
6+
- path: mage/golangci-lint.go
77
match: defaultGolangCILintVersion\s+=\s+"v(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?"
88

99
# ko
1010
- name: "ko"
11-
version: 0.14.1
11+
version: 0.15.0
1212
refPaths:
1313
- path: mage/ko.go
1414
match: defaultKoVersion\s+=\s+"(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?"

editor/editor.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ func (e Editor) args(path string) []string {
101101
last := args[len(args)-1]
102102
args[len(args)-1] = fmt.Sprintf("%s %q", last, path)
103103
} else {
104-
args = append(args, path) // nolint: makezero
104+
args = append(args, path) //nolint: makezero
105105
}
106106
return args
107107
}
@@ -117,7 +117,8 @@ func (e Editor) Launch(path string) error {
117117
return err
118118
}
119119
args := e.args(abs)
120-
cmd := exec.Command(args[0], args[1:]...)
120+
// TODO: check to validate the args and maybe sabitize those
121+
cmd := exec.Command(args[0], args[1:]...) //nolint: gosec
121122
cmd.Stdout = os.Stdout
122123
cmd.Stderr = os.Stderr
123124
cmd.Stdin = os.Stdin

hash/hash.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ limitations under the License.
1717
package hash
1818

1919
import (
20-
"crypto/sha1"
20+
"crypto/sha1" //nolint: gosec
2121
"crypto/sha256"
2222
"crypto/sha512"
2323
"encoding/hex"
@@ -41,8 +41,9 @@ func SHA256ForFile(filename string) (string, error) {
4141
}
4242

4343
// SHA1ForFile returns the hex-encoded sha1 hash for the provided filename.
44+
// TODO: check if we can remove this function
4445
func SHA1ForFile(filename string) (string, error) {
45-
return ForFile(filename, sha1.New())
46+
return ForFile(filename, sha1.New()) //nolint: gosec
4647
}
4748

4849
// ForFile returns the hex-encoded hash for the provided filename and hasher.

0 commit comments

Comments
 (0)