Skip to content

Commit ff19c12

Browse files
authored
Migrates golangci-lint to v2 (#1445)
* add some linters, make linter happy again * remove comments * fix * nit
1 parent c9330f6 commit ff19c12

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

73 files changed

+73
-117
lines changed

.golangci.yml

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,23 @@
1-
run:
2-
deadline: 5m
3-
1+
version: "2"
2+
timeout: 5m
43
linters:
5-
disable-all: true
4+
default: none
65
enable:
7-
# Enabled by default, see https://golangci-lint.run/usage/linters#enabled-by-default
86
- errcheck
9-
- gosimple
7+
- errname
8+
- gocritic
109
- govet
1110
- ineffassign
1211
- staticcheck
13-
- typecheck
1412
- unused
15-
- goimports
13+
- misspell
14+
exclusions:
15+
generated: lax
16+
presets:
17+
- common-false-positives
18+
- std-error-handling
19+
formatters:
20+
enable:
1621
- gofmt
17-
- gocritic
18-
issues:
19-
exclude-rules:
20-
- path: magefile\.go
21-
linters:
22-
- deadcode
22+
- goimports
23+

experimental/plugins/auditlog_formatter_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
// SPDX-License-Identifier: Apache-2.0
33

44
//go:build !tinygo
5-
// +build !tinygo
65

76
// Not aimed to tinygo as serial writer is a noop writer
87

experimental/plugins/auditlog_formatter_tinygo_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
// SPDX-License-Identifier: Apache-2.0
33

44
//go:build tinygo
5-
// +build tinygo
65

76
// Aimed to tinygo, initializing a dedicated serial writer
87
package plugins_test

experimental/plugins/auditlog_writer_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
// SPDX-License-Identifier: Apache-2.0
33

44
//go:build !tinygo
5-
// +build !tinygo
65

76
package plugins_test
87

experimental/plugins/plugintypes/auditlog.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ type AuditLogTransactionRequest interface {
6464
Headers() map[string][]string
6565
Body() string
6666
Files() []AuditLogTransactionRequestFiles
67-
Args() *collections.ConcatKeyed // A string representation of all request agruments in the format 'k=v,'
67+
Args() *collections.ConcatKeyed // A string representation of all request arguments in the format 'k=v,'
6868
Length() int32 // The total size of the request in bytes
6969
}
7070

http/e2e/cmd/httpe2e/main.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
// SPDX-License-Identifier: Apache-2.0
33

44
//go:build !tinygo
5-
// +build !tinygo
65

76
package main
87

http/e2e/e2e.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
// SPDX-License-Identifier: Apache-2.0
33

44
//go:build !tinygo
5-
// +build !tinygo
65

76
package e2e
87

@@ -274,7 +273,7 @@ func Run(cfg Config) error {
274273
timeout--
275274
if timeout == 0 {
276275
if err != nil {
277-
return fmt.Errorf("timeout waiting for response from %s, make sure the server is running. Last request error: %v", healthCheck.url, err)
276+
return fmt.Errorf("timeout waiting for response from %s, make sure the server is running. Last request error: %w", healthCheck.url, err)
278277
}
279278

280279
return fmt.Errorf("timeout waiting for response from %s, unexpected status code", healthCheck.url)

http/e2e/e2e_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
// SPDX-License-Identifier: Apache-2.0
33

44
//go:build !tinygo
5-
// +build !tinygo
65

76
package e2e
87

http/interceptor.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33

44
// tinygo does not support net.http so this package is not needed for it
55
//go:build !tinygo
6-
// +build !tinygo
76

87
package http
98

@@ -77,7 +76,7 @@ func (i *rwInterceptor) cleanHeaders() {
7776
// interruption is triggered, this buffer is later used to analyse the body in
7877
// the response processor.
7978
// If the body isn't accessible or the mime type isn't processable, the response
80-
// body is being writen to the delegate response writer directly.
79+
// body is being written to the delegate response writer directly.
8180
func (i *rwInterceptor) Write(b []byte) (int, error) {
8281
if i.tx.IsInterrupted() {
8382
// if there is an interruption it must be from at least phase 4 and hence
@@ -184,15 +183,15 @@ func wrap(w http.ResponseWriter, r *http.Request, tx types.Transaction) (
184183
if err != nil {
185184
i.overrideWriteHeader(http.StatusInternalServerError)
186185
i.flushWriteHeader()
187-
return fmt.Errorf("failed to release the response body reader: %v", err)
186+
return fmt.Errorf("failed to release the response body reader: %w", err)
188187
}
189188

190189
// this is the last opportunity we have to report the resolved status code
191190
// as next step is write into the response writer (triggering a 200 in the
192191
// response status code.)
193192
i.flushWriteHeader()
194193
if _, err := io.Copy(w, reader); err != nil {
195-
return fmt.Errorf("failed to copy the response body: %v", err)
194+
return fmt.Errorf("failed to copy the response body: %w", err)
196195
}
197196
} else {
198197
i.flushWriteHeader()

http/interceptor_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33

44
// tinygo does not support net.http so this package is not needed for it
55
//go:build !tinygo
6-
// +build !tinygo
76

87
package http
98

0 commit comments

Comments
 (0)