This is an automated email from the ASF dual-hosted git repository.

djwang pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/cloudberry-backup.git

commit c365317a5fc436af3e4f950678b5edd81a341e8c
Author: woblerr <[email protected]>
AuthorDate: Tue Apr 7 12:46:12 2026 +0300

    Migrate golangci-lint from v1 to v2.
    
    Update golangci-lint from 1.16.0 to 2.10.1 in Makefile.
    Create .golangci.yml with v2 configuration format.
    Remove obsolete gometalinter.config.
    
    Linter mapping from gometalinter.config:
    - golint -> revive (with shadow check enabled)
    - vet -> govet
    - varcheck -> unused
    - unparam and errcheck remain unchanged
    
    TODO: consider enabling additional linters in a follow-up PR:
    dupl, gochecknoinits, gocritic, gocyclo, gosec, ineffassign,
    misspell, nakedret, prealloc, staticcheck, unconvert.
    
    Current goal is to migrate the existing config as-is.
---
 .golangci.yml       | 42 ++++++++++++++++++++++++++++++++++++++++++
 Makefile            |  6 +++---
 gometalinter.config | 12 ------------
 3 files changed, 45 insertions(+), 15 deletions(-)

diff --git a/.golangci.yml b/.golangci.yml
new file mode 100644
index 00000000..7625a743
--- /dev/null
+++ b/.golangci.yml
@@ -0,0 +1,42 @@
+version: "2"
+
+linters:
+  default: none
+  enable:
+    - errcheck
+    - govet
+    - revive
+    - unparam
+    - unused
+  settings:
+    govet:
+      enable:
+        - shadow
+    revive:
+      confidence: 0.1
+  exclusions:
+    generated: lax
+    rules:
+      - linters:
+          - revive
+        text: should have comment
+      - linters:
+          - revive
+        text: comment on exported
+      - linters:
+          - revive
+        text: should not use dot imports
+      - linters:
+          - revive
+        text: don't use ALL_CAPS in Go names; use CamelCase
+      - linters:
+          - revive
+        text: and that stutters
+      - linters:
+          - revive
+        text: don't use an underscore in package name
+    paths:
+      - vendor
+
+run:
+  timeout: 5m
diff --git a/Makefile b/Makefile
index 9ec10c47..12b5fd44 100644
--- a/Makefile
+++ b/Makefile
@@ -54,15 +54,15 @@ $(GOSQLITE) :
 format : $(GOIMPORTS)
                @goimports -w $(shell find . -type f -name '*.go' -not -path 
"./vendor/*")
 
-LINTER_VERSION=1.16.0
+LINTER_VERSION=2.10.1
 $(GOLANG_LINTER) :
                mkdir -p $(GOPATH)/bin
-               curl -sfL 
https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh 
-s -- -b $(GOPATH)/bin v${LINTER_VERSION}
+               curl -sfL 
https://raw.githubusercontent.com/golangci/golangci-lint/main/install.sh | sh 
-s -- -b $(GOPATH)/bin v${LINTER_VERSION}
 
 .PHONY : coverage integration end_to_end
 
 lint : $(GOLANG_LINTER)
-               golangci-lint run --tests=false
+               golangci-lint run
 
 unit : $(GINKGO)
        TEST_DB_TYPE=CBDB TEST_DB_VERSION=2.999.0 ginkgo $(GINKGO_FLAGS) 
$(SUBDIRS_HAS_UNIT) 2>&1
diff --git a/gometalinter.config b/gometalinter.config
deleted file mode 100644
index 74193c99..00000000
--- a/gometalinter.config
+++ /dev/null
@@ -1,12 +0,0 @@
-{
-  "DisableAll": true,
-  "Enable": ["golint", "vet", "varcheck", "unparam", "errcheck"],
-  "Exclude": [
-    "should have comment",
-    "comment on exported",
-    "should not use dot imports",
-    "don't use ALL_CAPS in Go names; use CamelCase",
-       "and that stutters",
-       "don't use an underscore in package name"
-  ]
-}


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to