Browse Source

build: reactivate golangci-lint (#10118)

With DeepSource becoming (imho) less and less useful, let's get this one
back on track. It will likely require adjusting over time.
Jakob Borg 5 months ago
parent
commit
9a3493c2f4
2 changed files with 59 additions and 11 deletions
  1. 20 0
      .github/workflows/build-syncthing.yaml
  2. 39 11
      .golangci.yml

+ 20 - 0
.github/workflows/build-syncthing.yaml

@@ -127,6 +127,7 @@ jobs:
       - package-debian
       - package-windows
       - govulncheck
+      - golangci
     steps:
       - uses: actions/checkout@v4
 
@@ -1020,3 +1021,22 @@ jobs:
           go run build.go assets
           go install golang.org/x/vuln/cmd/govulncheck@latest
           govulncheck ./...
+
+  golangci:
+    runs-on: ubuntu-latest
+    name: Run golangci-lint
+    steps:
+      - uses: actions/checkout@v4
+      - uses: actions/setup-go@v5
+        with:
+          go-version: ${{ env.GO_VERSION }}
+          cache: false
+          check-latest: true
+
+      - name: ensure asset generation
+        run: go run build.go assets
+
+      - name: golangci-lint
+        uses: golangci/golangci-lint-action@v8
+        with:
+          only-new-issues: true

+ 39 - 11
.golangci.yml

@@ -1,39 +1,67 @@
+version: "2"
 linters:
-  enable-all: true
+  default: all
   disable:
     - cyclop
     - depguard
     - exhaustive
     - exhaustruct
+    - forbidigo
     - funlen
-    - gci
     - gochecknoglobals
     - gochecknoinits
     - gocognit
     - goconst
     - gocyclo
     - godox
-    - gofmt
-    - goimports
     - gomoddirectives
     - inamedparam
     - interfacebloat
     - ireturn
     - lll
     - maintidx
+    - mnd
+    - musttag
     - nestif
+    - nlreturn
     - nonamedreturns
     - paralleltest
+    - prealloc
+    - predeclared
     - protogetter
-    - scopelint
+    - recvcheck
+    - revive
     - tagalign
     - tagliatelle
     - testpackage
+    - usetesting # go 1.24
     - varnamelen
+    - whitespace
+    - wrapcheck
     - wsl
-
-issues:
-  exclude-dirs:
-    - internal/gen
-    - cmd/dev
-    - repos
+  exclusions:
+    generated: lax
+    presets:
+      - comments
+      - common-false-positives
+      - legacy
+      - std-error-handling
+    paths:
+      - internal/gen
+      - cmd/dev
+      - repos
+      - third_party$
+      - builtin$
+      - examples$
+formatters:
+  enable:
+    - gofumpt
+  exclusions:
+    generated: lax
+    paths:
+      - internal/gen
+      - cmd/dev
+      - repos
+      - third_party$
+      - builtin$
+      - examples$