From 33d2b50cb92e26588e5f089a31458178b40b23db Mon Sep 17 00:00:00 2001 From: yibin Date: Tue, 4 Nov 2025 17:06:06 +0800 Subject: [PATCH] Revert "Revert "update go version to 1.25" (#316)" This reverts commit 0838db900c6afcbf0946795317dcdd502544450f. --- .github/workflows/ci.yml | 2 +- .golangci.yml | 102 ++++++++++++++++++++++++--------------- Makefile | 2 +- go.mod | 2 +- 4 files changed, 67 insertions(+), 41 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 306b5a0..84237f6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -17,7 +17,7 @@ jobs: - uses: actions/checkout@v3 - uses: actions/setup-go@v3 with: - go-version: '1.24.2' + go-version: '1.25.3' - name: Format run: make fmt - name: Lint diff --git a/.golangci.yml b/.golangci.yml index d211baf..6758e9e 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -1,44 +1,70 @@ -run: - timeout: 10m +version: "2" linters: - disable-all: true + default: none enable: - - misspell - - ineffassign - - typecheck - # - varcheck - - unused - # - structcheck - # - deadcode - - gosimple - - goimports - - errcheck - - staticcheck - - stylecheck - - gosec - asciicheck - bodyclose - # - exportloopref - # - copyloopvar - - rowserrcheck - - unconvert - - makezero - durationcheck + - errcheck + - gosec + - ineffassign + - makezero + - misspell - prealloc - -linters-settings: - staticcheck: - checks: ["S1002","S1004","S1007","S1009","S1010","S1012","S1019","S1020","S1021","S1024","S1030","SA2*","SA3*","SA4009","SA5*","SA6000","SA6001","SA6005", "-SA2002"] - stylecheck: - checks: ["-ST1003"] -issues: - exclude-rules: - - path: _test\.go - linters: - - errcheck - - gosec - - rowserrcheck - - makezero - - linters: - - gosec - text: "G115:" + - rowserrcheck + - staticcheck + - unconvert + - unused + settings: + staticcheck: + checks: + - -SA2002 + - -ST1003 + - S1002 + - S1004 + - S1007 + - S1009 + - S1010 + - S1012 + - S1019 + - S1020 + - S1021 + - S1024 + - S1030 + - SA2* + - SA3* + - SA4009 + - SA5* + - SA6000 + - SA6001 + - SA6005 + exclusions: + generated: lax + presets: + - comments + - common-false-positives + - legacy + - std-error-handling + rules: + - linters: + - errcheck + - gosec + - makezero + - rowserrcheck + path: _test\.go + - linters: + - gosec + text: 'G115:' + paths: + - third_party$ + - builtin$ + - examples$ +formatters: + enable: + - goimports + exclusions: + generated: lax + paths: + - third_party$ + - builtin$ + - examples$ diff --git a/Makefile b/Makefile index fbc636b..509d8c9 100644 --- a/Makefile +++ b/Makefile @@ -48,4 +48,4 @@ lint: tools/bin/golangci-lint GO111MODULE=on tools/bin/golangci-lint run -v $$($(PACKAGE_DIRECTORIES)) --config .golangci.yml tools/bin/golangci-lint: - curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh| sh -s -- -b ./tools/bin v1.64.5 + curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh| sh -s -- -b ./tools/bin v2.4.0 diff --git a/go.mod b/go.mod index 94d1d8f..81242c0 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/pingcap/ng-monitoring -go 1.24.6 +go 1.25.3 require ( github.com/BurntSushi/toml v1.3.2