summaryrefslogtreecommitdiffhomepage
path: root/tools/checklocks/checklocks.go
diff options
context:
space:
mode:
authorAdin Scannell <ascannell@google.com>2021-09-13 10:51:23 -0700
committergVisor bot <gvisor-bot@google.com>2021-09-13 10:54:24 -0700
commit6bcacb2fd17fadefbc9fb2eed9059eb36ae2783b (patch)
tree744e285e7e29173e1063591f0d7d7f9eccf4afbc /tools/checklocks/checklocks.go
parent63b1c736b3bbb71cc7019fddec0e706133a2f61e (diff)
Support anonymous structs in checklocks.
Fixes #6558 PiperOrigin-RevId: 396393293
Diffstat (limited to 'tools/checklocks/checklocks.go')
-rw-r--r--tools/checklocks/checklocks.go6
1 files changed, 4 insertions, 2 deletions
diff --git a/tools/checklocks/checklocks.go b/tools/checklocks/checklocks.go
index 180f8873f..401fb55ec 100644
--- a/tools/checklocks/checklocks.go
+++ b/tools/checklocks/checklocks.go
@@ -90,12 +90,14 @@ func run(pass *analysis.Pass) (interface{}, error) {
// Find all struct declarations and export relevant facts.
pc.forAllTypes(func(ts *ast.TypeSpec) {
if ss, ok := ts.Type.(*ast.StructType); ok {
- pc.exportLockFieldFacts(ts, ss)
+ structType := pc.pass.TypesInfo.TypeOf(ts.Name).Underlying().(*types.Struct)
+ pc.exportLockFieldFacts(structType, ss)
}
})
pc.forAllTypes(func(ts *ast.TypeSpec) {
if ss, ok := ts.Type.(*ast.StructType); ok {
- pc.exportLockGuardFacts(ts, ss)
+ structType := pc.pass.TypesInfo.TypeOf(ts.Name).Underlying().(*types.Struct)
+ pc.exportLockGuardFacts(structType, ss)
}
})