Files
navidrome/tools/ctxvariant/plugin.go
T
Deluan f8ed972e4c chore(lint): add the ctxvariant linter
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.
2026-11-17 20:19:10 -05:00

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 }