fix: drop NeedDeps from the slog duration guard's package load

The guard only reads types for the syntax it walks, which resolves from
dependency export data; NeedDeps type-checked the whole graph from source for
no extra coverage. Verified identical detection either way (160 packages, 993
files, 3684 slog call sites, and both violation classes still caught).
19.0s to 7.3s under -race.
This commit is contained in:
Julian Sommer
2026-09-01 11:48:30 +10:00
parent 481df170f5
commit 4abbab59af
+4 -1
View File
@@ -33,9 +33,12 @@ var logMethods = map[string]bool{
func TestSlogDurationConvention(t *testing.T) {
root := moduleRoot(t)
// No NeedDeps: the guard only reads types for the syntax it walks, which
// resolves from dependency export data. Asking for dependency syntax as
// well type-checks the whole graph from source for no extra coverage.
cfg := &packages.Config{
Mode: packages.NeedName | packages.NeedSyntax | packages.NeedTypes |
packages.NeedTypesInfo | packages.NeedDeps | packages.NeedImports,
packages.NeedTypesInfo | packages.NeedImports,
Dir: root,
}
pkgs, err := packages.Load(cfg, "./spinifex/...", "./cmd/...")