mirror of
https://github.com/navidrome/navidrome.git
synced 2026-12-03 18:36:56 +00:00
ctxvariant (tools/ctxvariant, a golangci-lint module plugin built via .custom-gcl.yml) reports a call to F when FContext or FWithContext takes the same arguments after a leading ctx, plus stdlib calls whose ctx variant is named differently (http.Get, net.Listen/Dial, DB.Begin, ...). It replaces the migration-only forbidigo SQL rules. Not noctx: it misses closures in package-level vars (every Ginkgo spec) and packages without a direct import. Fixes 702 call sites: 658 in tests, 14 in server code, 30 in migrations. The migrations now use ctx-aware calls; they already ran every other query with the same ctx, so their behavior is the same.
19 lines
441 B
Go
19 lines
441 B
Go
package ctxvariant
|
|
|
|
import (
|
|
"github.com/golangci/plugin-module-register/register"
|
|
"golang.org/x/tools/go/analysis"
|
|
)
|
|
|
|
func init() {
|
|
register.Plugin("ctxvariant", func(any) (register.LinterPlugin, error) { return plugin{}, nil })
|
|
}
|
|
|
|
type plugin struct{}
|
|
|
|
func (plugin) BuildAnalyzers() ([]*analysis.Analyzer, error) {
|
|
return []*analysis.Analyzer{Analyzer}, nil
|
|
}
|
|
|
|
func (plugin) GetLoadMode() string { return register.LoadModeTypesInfo }
|