mirror of
https://github.com/esengine/DeepSeek-Reasonix.git
synced 2026-11-07 10:45:59 -10:00
* refactor(go): adopt modern stdlib idioms across kernel and desktop Mechanical sweep with golangci-lint's modernize/intrange/copyloopvar/ usestdlibvars fixers plus hand-fixes for what they could not rewrite: slices.Contains, min/max, slices.Backward, WaitGroup.Go, reflect.TypeFor, maps.Copy, strings.Cut/CutPrefix/SplitSeq, strings.Builder, range-over-int. Net -549 lines with no behavior change. Three loops in session.go stay index-based: slices.Backward yields element copies, so the fixer's rewrite silently dropped writes to DecisionReceipts and ToolCalls (caught by TestDelivery* and TestDependentSameBatch*). All 49 slices.Backward sites were audited for that shape; only these three write through the index, and they carry a nolint with the reason. CaptureAfter's scan loop had an empty body and never ran any logic, so the fixer could not express it. Drop it and the accessor it was the only caller of. omitzero is deliberately untouched: turning omitempty into omitzero changes the JSON written for nested structs, which is a wire-format change to session files and the extension protocol. * build(lint): gate the modern-idiom linters Nothing stopped the codebase from drifting back to pre-1.22 idioms. Both modules are now clean for modernize, intrange, copyloopvar, and usestdlibvars, so enable them rather than leaving the sweep as a one-off. omitzero stays disabled with the reason inline; usetesting, perfsprint, and errorlint still have residue and land separately.
65 lines
2.0 KiB
YAML
65 lines
2.0 KiB
YAML
version: "2"
|
|
|
|
linters:
|
|
enable:
|
|
- copyloopvar
|
|
- errcheck
|
|
- errorlint
|
|
- govet
|
|
- ineffassign
|
|
- intrange
|
|
- modernize
|
|
- staticcheck
|
|
- unused
|
|
- usestdlibvars
|
|
settings:
|
|
modernize:
|
|
# omitempty -> omitzero changes which fields are written for nested
|
|
# structs. That is a wire-format change to session files and the
|
|
# extension protocol, not a refactor, so it lands on its own.
|
|
disable:
|
|
- omitzero
|
|
errcheck:
|
|
check-type-assertions: false
|
|
exclude-functions:
|
|
- (*os.File).Close
|
|
- (io.Closer).Close
|
|
- (*net/http.Response).Body.Close
|
|
- golang.org/x/term.Restore
|
|
# Win32: CloseHandle in a defer mirrors the Close exclusions above, and
|
|
# LazyProc.Call always returns a non-nil errno — the caller reads r1.
|
|
- golang.org/x/sys/windows.CloseHandle
|
|
- (*syscall.LazyProc).Call
|
|
- (*golang.org/x/sys/windows.LazyProc).Call
|
|
staticcheck:
|
|
checks:
|
|
- all
|
|
- -ST1005 # error strings ending with punctuation — too strict for initial adoption
|
|
- -ST1018 # Unicode format characters — intentional in TUI code
|
|
- -QF1001 # De Morgan's law — readability preference
|
|
exclusions:
|
|
generated: lax
|
|
presets:
|
|
- comments
|
|
- common-false-positives
|
|
- legacy
|
|
- std-error-handling
|
|
rules:
|
|
# Setup/teardown in tests routinely ignores cleanup errors.
|
|
- path: _test\.go
|
|
linters:
|
|
- errcheck
|
|
# The pinned golangci-lint binary's staticcheck reports SA5011 false
|
|
# positives on `if x == nil { t.Fatal(...) }`-guarded derefs in tests (it
|
|
# doesn't treat t.Fatal as terminating); the same code is clean under a
|
|
# locally-built golangci-lint. Scope the suppression to tests so SA5011
|
|
# still guards production code.
|
|
- path: _test\.go
|
|
linters:
|
|
- staticcheck
|
|
text: SA5011
|
|
|
|
issues:
|
|
max-issues-per-linter: 0
|
|
max-same-issues: 0
|