浏览代码

Update linter version

Shelikhoo 4 月之前
父节点
当前提交
f0d87d13d6
共有 2 个文件被更改,包括 53 次插入40 次删除
  1. 51 38
      .github/linters/.golangci.yml
  2. 2 2
      .github/workflows/linter.yml

+ 51 - 38
.github/linters/.golangci.yml

@@ -1,57 +1,70 @@
-run:
-  timeout: 5m
-
-issues:
-  new: true
-  exclude-rules:
-    - linters:
-        - staticcheck
-      text: "SA1019:"
-    - linters:
-        - stylecheck
-      text: "ST1016:"
-  exclude-files:
-    - generated.*
-    - .pb.go
-
+version: "2"
 linters:
   enable:
     - asciicheck
     - bodyclose
     - depguard
     - gocritic
-    - gofmt
-    - gofumpt
-    - goimports
     - goprintffuncname
-    - gosimple
-    - govet
-    - ineffassign
     - misspell
     - nakedret
     - revive
     - rowserrcheck
     - staticcheck
-    - stylecheck
-    - typecheck
     - unconvert
     - unparam
     - whitespace
   disable:
     - errcheck
     - unused
-
-linters-settings:
-  goimports:
-    local-prefixes: github.com/v2fly/v2ray-core
-  revive:
-    rules:
-      - name: blank-imports
-        severity: warning
-        disabled: true
-  depguard:
+  settings:
+    depguard:
+      rules:
+        Main:
+          deny:
+            - pkg: github.com/pkg/errors
+              desc: Should be replaced by standard lib errors package
+    revive:
+      rules:
+        - name: blank-imports
+          severity: warning
+          disabled: true
+  exclusions:
+    generated: lax
+    presets:
+      - comments
+      - common-false-positives
+      - legacy
+      - std-error-handling
     rules:
-      Main:
-        deny:
-          - pkg: "github.com/pkg/errors"
-            desc: Should be replaced by standard lib errors package
+      - linters:
+          - staticcheck
+        text: 'SA1019:'
+      - linters:
+          - staticcheck
+        text: 'ST1016:'
+    paths:
+      - generated.*
+      - .pb.go
+      - third_party$
+      - builtin$
+      - examples$
+issues:
+  new: true
+formatters:
+  enable:
+    - gofmt
+    - gofumpt
+    - goimports
+  settings:
+    goimports:
+      local-prefixes:
+        - github.com/v2fly/v2ray-core
+  exclusions:
+    generated: lax
+    paths:
+      - generated.*
+      - .pb.go
+      - third_party$
+      - builtin$
+      - examples$

+ 2 - 2
.github/workflows/linter.yml

@@ -28,8 +28,8 @@ jobs:
         uses: actions/checkout@v3
 
       - name: golangci-lint
-        uses: golangci/golangci-lint-action@v6
+        uses: golangci/golangci-lint-action@v8
         with:
-          version: v1.63
+          version: v2.1.6
           args: --config=.github/linters/.golangci.yml
           only-new-issues: true