Skip to content

Commit 5da93b5

Browse files
authored
Merge pull request #204 from slashpai/update-deps
chore: upgrade go version to 1.24.4 and golangci-lint to 2.1.6
2 parents eab0ddf + b0b76df commit 5da93b5

File tree

4 files changed

+42
-22
lines changed

4 files changed

+42
-22
lines changed

.golangci.yml

Lines changed: 37 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1+
version: "2"
12
run:
23
timeout: 7m
3-
44
linters:
5-
disable-all: true
5+
default: standard
66
enable:
77
- bodyclose
88
- copyloopvar
@@ -11,27 +11,49 @@ linters:
1111
- errcheck
1212
- gocritic
1313
- gocyclo
14-
- gofmt
15-
- goimports
16-
- gosec
1714
- goprintffuncname
18-
- gosimple
15+
- gosec
1916
- govet
2017
- ineffassign
2118
- misspell
2219
- nakedret
2320
- nolintlint
2421
- revive
2522
- staticcheck
26-
- stylecheck
27-
- typecheck
2823
- unconvert
2924
- unused
3025
- whitespace
31-
32-
linters-settings:
33-
goimports:
34-
local-prefixes: sigs.k8s.io/custom-metrics-apiserver
35-
misspell:
36-
ignore-words:
37-
- "creater" # Cf. e.g. https://pkg.go.dev/k8s.io/apimachinery@v0.24.3/pkg/runtime#ObjectCreater
26+
settings:
27+
misspell:
28+
ignore-rules:
29+
- creater
30+
staticcheck:
31+
checks:
32+
- all
33+
# Disable QF1008 to retain embedded fields for better readability.
34+
- "-QF1008"
35+
exclusions:
36+
generated: lax
37+
presets:
38+
- comments
39+
- common-false-positives
40+
- legacy
41+
- std-error-handling
42+
paths:
43+
- third_party$
44+
- builtin$
45+
- examples$
46+
formatters:
47+
enable:
48+
- gofmt
49+
- goimports
50+
settings:
51+
goimports:
52+
local-prefixes:
53+
- sigs.k8s.io/custom-metrics-apiserver
54+
exclusions:
55+
generated: lax
56+
paths:
57+
- third_party$
58+
- builtin$
59+
- examples$

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ GOPATH:=$(shell go env GOPATH)
77

88
VERSION?=latest
99

10-
GOLANGCI_VERSION:=1.64.8
10+
GOLANGCI_VERSION:=2.1.6
1111

1212
.PHONY: all
1313
all: build-test-adapter
@@ -48,7 +48,7 @@ build-test-adapter: update-generated
4848
# Format and lint
4949
# ---------------
5050

51-
HAS_GOLANGCI_VERSION:=$(shell $(GOPATH)/bin/golangci-lint version --format=short)
51+
HAS_GOLANGCI_VERSION:=$(shell $(GOPATH)/bin/golangci-lint version --short)
5252
.PHONY: golangci
5353
golangci:
5454
ifneq ($(HAS_GOLANGCI_VERSION), $(GOLANGCI_VERSION))

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ module sigs.k8s.io/custom-metrics-apiserver
22

33
go 1.24.0
44

5-
toolchain go1.24.2
5+
toolchain go1.24.4
66

77
require (
88
github.com/emicklei/go-restful/v3 v3.12.2

test-adapter/provider/provider.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -157,10 +157,8 @@ func (p *testingProvider) updateMetric(request *restful.Request, response *restf
157157

158158
namespace := request.PathParameter("namespace")
159159
resourceType := request.PathParameter("resourceType")
160-
namespaced := false
161-
if len(namespace) > 0 || resourceType == "namespaces" {
162-
namespaced = true
163-
}
160+
namespaced := len(namespace) > 0 || resourceType == "namespaces"
161+
164162
name := request.PathParameter("name")
165163
metricName := request.PathParameter("metric")
166164

0 commit comments

Comments
 (0)