diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index c3a8dcf6..7c876bb7 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -28,9 +28,9 @@ jobs: go-version-file: './go.mod' - name: golangci-lint - uses: golangci/golangci-lint-action@v6 + uses: golangci/golangci-lint-action@v9 with: - version: v1.64.7 + version: v2.15.0 fmt: name: fmt diff --git a/.golangci.yml b/.golangci.yml index ec3319d6..25ce7c05 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -1,45 +1,77 @@ +version: "2" run: timeout: 10m linters: - disable-all: true + default: none enable: - asciicheck - bodyclose - durationcheck - errcheck - - goimports - gosec - - gosimple - ineffassign - makezero - prealloc - predeclared - rowserrcheck - staticcheck - - stylecheck - - typecheck - unused - -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"] - gosec: - severity: "low" - confidence: "low" - excludes: - - G101 - - G115 - - G404 - # exclude warnings of using crypto/sha1 - - G505 - -issues: - exclude-rules: - - path: _test\.go - linters: - - errcheck - - gosec - - rowserrcheck - - makezero + settings: + gosec: + excludes: + - G101 + - G115 + - G404 + # exclude warnings of using crypto/sha1 + - G505 + severity: low + confidence: low + 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 + paths: + - third_party$ + - builtin$ + - examples$ +formatters: + enable: + - goimports + exclusions: + generated: lax + paths: + - third_party$ + - builtin$ + - examples$ diff --git a/Makefile b/Makefile index cd6ae38a..81c3ce24 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -GOLANGCI_VERSION=v1.64.7 +GOLANGCI_VERSION=v2.15.0 COVERAGE=coverage.out .PHONY: deps diff --git a/cmd/manifest/update_latest_version.go b/cmd/manifest/update_latest_version.go index f5c5d3ef..6a8baf58 100644 --- a/cmd/manifest/update_latest_version.go +++ b/cmd/manifest/update_latest_version.go @@ -58,7 +58,7 @@ func main() { latestTag = strings.TrimPrefix(latestTag, "v") file = regexp.MustCompile("version=\".*\"").ReplaceAll(file, []byte(fmt.Sprintf("version=\"%s\"", latestTag))) - err = os.WriteFile("install.sh", file, 0600) + err = os.WriteFile("install.sh", file, 0600) //nolint:gosec // The path is the constant "install.sh". if err != nil { log.Fatalf("Failed to write install.sh file: %s", err.Error()) } diff --git a/go.mod b/go.mod index 48e010f3..8815abc4 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/tidbcloud/tidbcloud-cli -go 1.24.0 +go 1.27.3 require ( github.com/AlecAivazis/survey/v2 v2.3.6