Skip to content

Commit 2f0b333

Browse files
committed
chore(golangci-lint): upgrading to v1.61.0
1 parent 5b007e1 commit 2f0b333

File tree

5 files changed

+17
-21
lines changed

5 files changed

+17
-21
lines changed

.golangci.yml

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
linters-settings:
2-
govet:
3-
check-shadowing: true
42
gci:
53
sections:
64
- standard
@@ -22,23 +20,21 @@ linters:
2220
- ireturn
2321
- varnamelen
2422
- wrapcheck
25-
- interfacer
26-
- maligned
27-
- golint
28-
- scopelint
2923
- gomnd
30-
- goerr113
31-
- exhaustivestruct
3224
- lll
33-
- ifshort
34-
- deadcode
35-
- structcheck
36-
- varcheck
37-
- nosnakecase
3825
- nonamedreturns
3926
- tparallel
4027
- nilerr
4128
- exhaustruct
4229
- depguard
43-
service:
44-
golangci-lint-version: 1.55.x
30+
# should be enabled
31+
- revive
32+
- err113
33+
- mnd
34+
- nilnil
35+
- wsl
36+
- perfsprint
37+
38+
# deprecated
39+
- exportloopref
40+
- execinquery

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ mkcert: ## Download mkcert locally if necessary.
264264
$(call go-install-tool,$(MKCERT),filippo.io/mkcert@$(MKCERT_VERSION))
265265

266266
GOLANGCI_LINT = $(shell pwd)/bin/golangci-lint
267-
GOLANGCI_LINT_VERSION = v1.55.2
267+
GOLANGCI_LINT_VERSION = v1.61.0
268268
golangci-lint: ## Download golangci-lint locally if necessary.
269269
$(call go-install-tool,$(GOLANGCI_LINT),github.com/golangci/golangci-lint/cmd/golangci-lint@$(GOLANGCI_LINT_VERSION))
270270

internal/webserver/middleware/jwt.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@
44
package middleware
55

66
import (
7-
"fmt"
87
"net/http"
98
"strings"
109

1110
"github.com/gorilla/mux"
11+
goerrors "github.com/pkg/errors"
1212
authenticationv1 "k8s.io/api/authentication/v1"
1313
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
1414
"k8s.io/apimachinery/pkg/util/sets"
@@ -43,10 +43,10 @@ func CheckJWTMiddleware(client client.Writer) mux.MiddlewareFunc {
4343
if statusErr := tr.Status.Error; len(statusErr) > 0 {
4444
invalidatedToken.Insert(token)
4545

46-
errors.HandleUnauthorized(writer, fmt.Errorf(statusErr), "cannot authenticate the token due to error")
46+
errors.HandleUnauthorized(writer, goerrors.New(statusErr), "cannot authenticate the token due to error")
4747
}
4848
case invalidatedToken.Has(token):
49-
errors.HandleUnauthorized(writer, fmt.Errorf("token is invalid"), "cannot authenticate the token due to error")
49+
errors.HandleUnauthorized(writer, goerrors.New("token is invalid"), "cannot authenticate the token due to error")
5050
}
5151

5252
next.ServeHTTP(writer, request)

internal/webserver/middleware/metrics_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ func Test_MetricsMiddleware_RequestCount(t *testing.T) {
5050

5151
rw := httptest.NewRecorder()
5252

53-
for i := 0; i < test.requestCount; i++ {
53+
for range test.requestCount {
5454
req, err := newRequest("GET", test.path)
5555
if err != nil {
5656
t.Errorf("failed to create HTTP request object")

internal/webserver/webserver.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ func (n *kubeFilter) registerModules(ctx context.Context, root *mux.Router) {
315315
case err != nil:
316316
var t moderrors.Error
317317
if errors.As(err, &t) {
318-
writer.Header().Set("content-type", "application/json")
318+
writer.Header().Set("Content-Type", "application/json")
319319
b, _ := json.Marshal(t.Status())
320320
_, _ = writer.Write(b)
321321
panic(err.Error())

0 commit comments

Comments
 (0)