carlos / platform Public

tests: keep the parser's objects in two single-file source scans

go/ast.Object is deprecated in favour of go/types. Two guards use it to
tell a package-level name from a local one while reading one file at a
time. Moving them means loading each package and its imports with
go/types, which is a redesign of the guard, not a swap, so each site
carries a lint:ignore that says so.

Comment only.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev pushed by paul@keymail.dev 9e6725859cdeccbd1b81b4ecd5a2dd386c853ba3 parent ca93c82
2 files changed, +3 −0
  • internal/apppolicy/writers_test.go +1 −0
  • internal/host/pagearm_test.go +2 −0
diff --git a/internal/apppolicy/writers_test.go b/internal/apppolicy/writers_test.go
index d6d144331..1d9a71865 100644
--- a/internal/apppolicy/writers_test.go
+++ b/internal/apppolicy/writers_test.go
@@ -314,6 +314,7 @@ func scanFile(fset *token.FileSet, f *ast.File, rel string, seen map[string]int)
return out
}
+//lint:ignore SA1019 this scan resolves names one file at a time; go/types would have to load every package it reads
func isTopFunc(o *ast.Object) bool {
fd, ok := o.Decl.(*ast.FuncDecl)
return o.Kind == ast.Fun && ok && fd.Recv == nil
diff --git a/internal/host/pagearm_test.go b/internal/host/pagearm_test.go
index 81d218b6f..ae37605f6 100644
--- a/internal/host/pagearm_test.go
+++ b/internal/host/pagearm_test.go
@@ -137,6 +137,7 @@ func TestRunAgentWiresCurrentInputs(t *testing.T) {
}
// declaredBy reports whether id was declared by an assignment whose one
// right-hand side satisfies rhs.
+ //lint:ignore SA1019 this witness parses agent.go alone; go/types would have to load internal/host's whole import graph
declaredBy := func(e ast.Expr, rhs func(ast.Expr) bool) (*ast.Object, bool) {
id, ok := e.(*ast.Ident)
if !ok || id.Obj == nil {
@@ -169,6 +170,7 @@ func TestRunAgentWiresCurrentInputs(t *testing.T) {
return ok && selector(cl.Type, "activator", "ExecBackend")
}
var wires []*ast.CallExpr
+ //lint:ignore SA1019 this witness parses agent.go alone; go/types would have to load internal/host's whole import graph
var served *ast.Object
var wiredAt, servedAt token.Pos
ast.Inspect(run, func(n ast.Node) bool {