// TestGoplsSourceDoesNotUseObjectResolution verifies that gopls does not // read fields that are set during syntactic object resolution, except in // locations where we can guarantee that object resolution has occurred. This // is achieved via static analysis of gopls source code to find references to // the legacy Object symbols, checking the results against an allowlist // // Reading these fields would introduce a data race, due to the lazy // resolution implemented by File.Resolve. func TestGoplsSourceDoesNotUseObjectResolution(t *testing.T) { … } // findEnclosingFuncDecl finds the name of the func decl enclosing the usage, // or "". // // (Usage could theoretically exist in e.g. var initializers, but that would be // odd.) func findEnclosingFuncDecl(ident *ast.Ident, pkg *packages.Package) string { … }