Skip to content

Commit a003d08

Browse files
shanshanyingclaude
andcommitted
chore: bump go version to 1.25 and update golangci-lint to v2.8.0
- Update go.mod to go 1.25.0 / toolchain go1.25.10 - Update Makefile: go mod tidy compat to 1.25, golangci-lint to v2.8.0 - Migrate .golangci.yaml to v2 format Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
1 parent 0150a7d commit a003d08

7 files changed

Lines changed: 42 additions & 52 deletions

File tree

.github/workflows/cicd-pull-request.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ on:
77
env:
88
GITHUB_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
99
BASE_BRANCH: origin/main
10-
GO_VERSION: "1.24"
10+
GO_VERSION: "1.25"
1111

1212
jobs:
1313
trigger-mode:
@@ -62,7 +62,7 @@ jobs:
6262

6363
- name: Install golangci-lint
6464
run: |
65-
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.64.8
65+
curl -sSfL https://golangci-lint.run/install.sh | sh -s -- -b $(go env GOPATH)/bin v2.8.0
6666
6767
- name: make module
6868
run: |

.github/workflows/cicd-push.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ on:
1111
env:
1212
GITHUB_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
1313
BASE_BRANCH: origin/main
14-
GO_VERSION: "1.24"
14+
GO_VERSION: "1.25"
1515

1616
jobs:
1717
trigger-mode:
@@ -139,7 +139,7 @@ jobs:
139139

140140
- name: Install golangci-lint
141141
run: |
142-
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.64.8
142+
curl -sSfL https://golangci-lint.run/install.sh | sh -s -- -b $(go env GOPATH)/bin v2.8.0
143143
144144
- name: make module
145145
run: |

.github/workflows/codeql.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ on:
88

99
env:
1010
BASE_BRANCH: origin/main
11-
GO_VERSION: "1.24"
11+
GO_VERSION: "1.25"
1212

1313
jobs:
1414
trigger-mode:

.github/workflows/release-kbcli.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ env:
99
GH_TOKEN: ${{ github.token }}
1010
GITHUB_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
1111
TAG_NAME: ${{ github.ref_name }}
12-
GO_VERSION: "1.24"
12+
GO_VERSION: "1.25"
1313
CLI_NAME: 'kbcli'
1414
JIHULAB_KBCLI_PROJECT_ID: 85948
1515
JIHULAB_ACCESS_TOKEN: ${{ secrets.GITLAB_ACCESS_TOKEN }}

.golangci.yaml

Lines changed: 27 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,39 @@
1-
# options for analysis running
1+
version: "2"
22
run:
3-
# default concurrency is a available CPU number
43
concurrency: 4
5-
6-
# timeout for analysis, e.g. 30s, 5m, default is 1m
7-
deadline: 15m
8-
9-
timeout: 30m
10-
11-
skip-files:
12-
- "^zz_generated.*"
13-
144
build-tags:
155
- containers_image_openpgp
16-
17-
output:
18-
# colored-line-number|line-number|json|tab|checkstyle|code-climate, default is "colored-line-number"
19-
format: colored-line-number
20-
21-
# print lines of code with issue, default is true
22-
print-issued-lines: true
23-
24-
# print linter name in the end of issue text, default is true
25-
print-linter-name: true
26-
27-
# check available linters @ https://golangci-lint.run/usage/linters/
286
linters:
29-
disable-all: true
30-
enable: # please keep this alphabetized
31-
# Don't use soon to deprecated[1] linters that lead to false
32-
# https://github.com/golangci/golangci-lint/issues/1841
33-
# - deadcode
34-
# - gocyclo
35-
# - loggercheck # requires golangci-lint@v1.49.0
36-
# - structcheck
37-
# - varcheck
7+
default: none
8+
enable:
389
- errcheck
3910
- gocritic
40-
# - goconst
41-
- goimports
42-
- gofmt # We enable this as well as goimports for its simplify mode.
4311
- govet
4412
- ineffassign
45-
- typecheck
4613
- misspell
4714
- nakedret
4815
- unconvert
49-
50-
linters-settings:
51-
errcheck:
52-
check-blank: false # to keep `_ = viper.BindPFlag(...)` from throwing errors
16+
settings:
17+
errcheck:
18+
check-blank: false
19+
exclusions:
20+
generated: lax
21+
presets:
22+
- comments
23+
- common-false-positives
24+
- legacy
25+
- std-error-handling
26+
paths:
27+
- third_party$
28+
- builtin$
29+
- examples$
30+
formatters:
31+
enable:
32+
- gofmt
33+
- goimports
34+
exclusions:
35+
generated: lax
36+
paths:
37+
- third_party$
38+
- builtin$
39+
- examples$

Makefile

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ mod-download: ## Run go mod download against go modules.
131131

132132
.PHONY: module
133133
module: ## Run go mod tidy->verify against go modules.
134-
$(GO) mod tidy -compat=1.24
134+
$(GO) mod tidy -compat=1.25
135135
$(GO) mod verify
136136

137137
TEST_PACKAGES ?= ./pkg/... ./cmd/...
@@ -257,16 +257,19 @@ install-docker-buildx: ## Create `docker buildx` builder.
257257
fi
258258

259259
.PHONY: golangci
260-
golangci: GOLANGCILINT_VERSION = v1.64.8
260+
golangci: GOLANGCILINT_VERSION = v2.8.0
261261
golangci: ## Download golangci-lint locally if necessary.
262-
ifneq ($(shell which golangci-lint),)
262+
ifeq ($(shell golangci-lint version >/dev/null 2>&1 && echo ok),ok)
263263
@echo golangci-lint is already installed
264264
GOLANGCILINT=$(shell which golangci-lint)
265265
else ifeq (, $(shell which $(GOBIN)/golangci-lint))
266266
@{ \
267267
set -e ;\
268268
echo 'installing golangci-lint-$(GOLANGCILINT_VERSION)' ;\
269-
curl -sSfL $(GITHUB_PROXY)https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(GOBIN) $(GOLANGCILINT_VERSION) ;\
269+
tmpfile=$$(mktemp) ;\
270+
trap 'rm -f "$$tmpfile"' EXIT ;\
271+
curl -sSfL https://golangci-lint.run/install.sh -o "$$tmpfile" ;\
272+
sh "$$tmpfile" -b $(GOBIN) $(GOLANGCILINT_VERSION) ;\
270273
echo 'Successfully installed' ;\
271274
}
272275
GOLANGCILINT=$(GOBIN)/golangci-lint

go.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
module github.com/apecloud/kbcli
22

3-
go 1.24.0
3+
go 1.25.0
44

5-
toolchain go1.24.9
5+
toolchain go1.25.10
66

77
require (
88
cuelang.org/go v0.8.0

0 commit comments

Comments
 (0)