From fa434cc1761e23592a3e19a4db4c7594529b7ff4 Mon Sep 17 00:00:00 2001 From: sentriz Date: Wed, 30 Jul 2025 12:48:04 +0100 Subject: [PATCH] chore(ci): bump golangci-lint --- .github/workflows/nightly-release.yaml | 6 +- .github/workflows/release.yaml | 6 +- .github/workflows/test.yaml | 6 +- .golangci.yml | 84 +++++++++++++++----------- db/migrations_old_models.go | 2 +- server/ctrlsubsonic/ctrl_test.go | 4 +- version.go | 2 +- 7 files changed, 63 insertions(+), 47 deletions(-) diff --git a/.github/workflows/nightly-release.yaml b/.github/workflows/nightly-release.yaml index 56c2bae..87e1dd0 100644 --- a/.github/workflows/nightly-release.yaml +++ b/.github/workflows/nightly-release.yaml @@ -33,10 +33,10 @@ jobs: sudo apt update -qq sudo apt install -y -qq build-essential git sqlite3 libtag1-dev ffmpeg mpv zlib1g-dev - name: Lint - uses: golangci/golangci-lint-action@v6 + uses: golangci/golangci-lint-action@v8 with: - version: v1.60 - args: --timeout=5m + install-mode: goinstall + version: v2.3.0 - name: Test run: go test ./... build-release: diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index bb9ffe8..f4a3c01 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -19,10 +19,10 @@ jobs: sudo apt update -qq sudo apt install -y -qq build-essential git sqlite3 libtag1-dev ffmpeg mpv zlib1g-dev - name: Lint - uses: golangci/golangci-lint-action@v6 + uses: golangci/golangci-lint-action@v8 with: - version: v1.60 - args: --timeout=5m + install-mode: goinstall + version: v2.3.0 - name: Test run: go test ./... release-please: diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 9935a02..c8c56a2 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -20,9 +20,9 @@ jobs: sudo apt update -qq sudo apt install -y -qq build-essential git sqlite3 libtag1-dev ffmpeg mpv zlib1g-dev - name: Lint - uses: golangci/golangci-lint-action@v6 + uses: golangci/golangci-lint-action@v8 with: - version: v1.60 - args: --timeout=5m + install-mode: goinstall + version: v2.3.0 - name: Test run: go test ./... diff --git a/.golangci.yml b/.golangci.yml index 8f1abde..d14b619 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -1,5 +1,6 @@ +version: "2" linters: - disable-all: true + default: none enable: - asasalint - asciicheck @@ -14,8 +15,6 @@ linters: - errchkjson - errname - errorlint - - execinquery - - exportloopref - forbidigo - ginkgolinter - gocheckcompilerdirectives @@ -24,13 +23,10 @@ linters: - goconst - gocritic - gocyclo - - gofmt - goheader - - goimports - gomodguard - goprintffuncname - gosec - - gosimple - gosmopolitan - govet - grouper @@ -51,40 +47,60 @@ linters: - rowserrcheck - sqlclosecheck - staticcheck - - stylecheck - - tenv - testableexamples - thelper - tparallel - - typecheck - unconvert - unparam - unused - wastedassign - whitespace - zerologlint - -issues: - exclude-rules: - - path: _test\.go - linters: - - errcheck - - gochecknoglobals - - text: "weak cryptographic primitive" - linters: - - gosec - - text: "weak random number generator" - linters: - - gosec - - text: "integer overflow conversion" - linters: - - gosec - - text: "at least one file in a package should have a package comment" - linters: - - stylecheck - - text: "should rewrite switch" - linters: - - gocritic - exclude-dirs: - - server/assets - exclude-dirs-use-default: true + exclusions: + generated: lax + presets: + - comments + - common-false-positives + - legacy + - std-error-handling + rules: + - linters: + - errcheck + - gochecknoglobals + path: _test\.go + - linters: + - gosec + text: weak cryptographic primitive + - linters: + - gosec + text: weak random number generator + - linters: + - gosec + text: integer overflow conversion + - linters: + - staticcheck + text: at least one file in a package should have a package comment + - linters: + - gocritic + text: should rewrite switch + paths: + - server/assets + - third_party$ + - builtin$ + - examples$ + settings: + staticcheck: + checks: + - all + - "-QF1001" +formatters: + enable: + - gofmt + - goimports + exclusions: + generated: lax + paths: + - server/assets + - third_party$ + - builtin$ + - examples$ diff --git a/db/migrations_old_models.go b/db/migrations_old_models.go index 7df9f45..7f398ed 100644 --- a/db/migrations_old_models.go +++ b/db/migrations_old_models.go @@ -2,7 +2,7 @@ package db import "time" -type __OldPlaylist struct { //nolint: revive,stylecheck +type __OldPlaylist struct { //nolint: staticcheck ID int `gorm:"primary_key"` CreatedAt time.Time UpdatedAt time.Time diff --git a/server/ctrlsubsonic/ctrl_test.go b/server/ctrlsubsonic/ctrl_test.go index 2dddea2..227ddd5 100644 --- a/server/ctrlsubsonic/ctrl_test.go +++ b/server/ctrlsubsonic/ctrl_test.go @@ -39,8 +39,8 @@ const ( ) const ( - audioPath5s = "testdata/audio/5s.flac" //nolint:deadcode,varcheck - audioPath10s = "testdata/audio/10s.flac" //nolint:deadcode,varcheck + audioPath5s = "testdata/audio/5s.flac" + audioPath10s = "testdata/audio/10s.flac" ) type queryCase struct { diff --git a/version.go b/version.go index 06c99af..43e12d5 100644 --- a/version.go +++ b/version.go @@ -1,4 +1,4 @@ -//nolint:gochecknoglobals,golint,stylecheck +//nolint:gochecknoglobals package gonic import (