fix: Update golangci-lint config to v2 format

- Migrate to golangci-lint v2.x config schema
- Move settings under linters.settings
- Move exclusions under linters.exclusions
- Add version: "2" to config
- Fix validation errors
This commit is contained in:
Steve Yegge
2025-11-01 23:51:36 -07:00
parent b61bf32339
commit a2361f85e7
+11 -28
View File
@@ -1,28 +1,20 @@
version: 2 version: "2"
run: run:
timeout: 5m timeout: 5m
tests: false tests: false
linters: linters:
disable: default: 'none'
- dupl
- goconst
- revive
enable: enable:
- errcheck - errcheck
- gosec - gosec
# - gocyclo # Disabled: high complexity acceptable for large functions (see LINTING.md)
- misspell - misspell
- unconvert - unconvert
- unparam - unparam
linters-settings: settings:
dupl:
threshold: 100
errcheck: errcheck:
check-type-assertions: false
check-blank: false
exclude-functions: exclude-functions:
- (*database/sql.DB).Close - (*database/sql.DB).Close
- (*database/sql.Rows).Close - (*database/sql.Rows).Close
@@ -36,25 +28,13 @@ linters-settings:
- (os).Unsetenv - (os).Unsetenv
- (os).Chdir - (os).Chdir
- (os).MkdirAll - (os).MkdirAll
goconst:
min-len: 3
min-occurrences: 3
gocyclo:
min-complexity: 15
misspell: misspell:
locale: US locale: US
revive:
rules:
- name: var-naming
- name: exported
issues: exclusions:
exclude-patterns: rules:
- "var-naming: avoid meaningless package names"
- "exported.*SQLiteStorage.*stutters"
exclude-rules:
# G304: File inclusion via variable in tests is safe (test data) # G304: File inclusion via variable in tests is safe (test data)
- path: _test\.go - path: '_test\.go'
linters: linters:
- gosec - gosec
text: "G304.*file inclusion via variable" text: "G304.*file inclusion via variable"
@@ -63,7 +43,7 @@ issues:
- gosec - gosec
text: "G302.*0700|G301.*0750" text: "G302.*0700|G301.*0750"
# G306: Git hooks must be executable (0700) # G306: Git hooks must be executable (0700)
- path: cmd/bd/init\.go - path: 'cmd/bd/init\.go'
linters: linters:
- gosec - gosec
text: "G306.*0700" text: "G306.*0700"
@@ -72,7 +52,10 @@ issues:
- gosec - gosec
text: 'G204.*git.*show|G204.*daemon' text: 'G204.*git.*show|G204.*daemon'
# errcheck: Ignore unchecked errors in test files for common cleanup patterns # errcheck: Ignore unchecked errors in test files for common cleanup patterns
- path: _test\.go - path: '_test\.go'
linters: linters:
- errcheck - errcheck
text: "Error return value of .*(Close|Rollback|RemoveAll|Setenv|Unsetenv|Chdir|MkdirAll|Remove|Write|SetReadDeadline|SetDeadline|Start|Stop).* is not checked" text: "Error return value of .*(Close|Rollback|RemoveAll|Setenv|Unsetenv|Chdir|MkdirAll|Remove|Write|SetReadDeadline|SetDeadline|Start|Stop).* is not checked"
issues:
uniq-by-line: true