const Doc … var Analyzer … func run(pass *analysis.Pass) (interface{ … } // checkCopyLocksAssign checks whether an assignment // copies a lock. func checkCopyLocksAssign(pass *analysis.Pass, assign *ast.AssignStmt, goversion string, parent ast.Node) { … } // checkCopyLocksGenDecl checks whether lock is copied // in variable declaration. func checkCopyLocksGenDecl(pass *analysis.Pass, gd *ast.GenDecl) { … } // checkCopyLocksCompositeLit detects lock copy inside a composite literal func checkCopyLocksCompositeLit(pass *analysis.Pass, cl *ast.CompositeLit) { … } // checkCopyLocksReturnStmt detects lock copy in return statement func checkCopyLocksReturnStmt(pass *analysis.Pass, rs *ast.ReturnStmt) { … } // checkCopyLocksCallExpr detects lock copy in the arguments to a function call func checkCopyLocksCallExpr(pass *analysis.Pass, ce *ast.CallExpr) { … } // checkCopyLocksFunc checks whether a function might // inadvertently copy a lock, by checking whether // its receiver, parameters, or return values // are locks. func checkCopyLocksFunc(pass *analysis.Pass, name string, recv *ast.FieldList, typ *ast.FuncType) { … } // checkCopyLocksRange checks whether a range statement // might inadvertently copy a lock by checking whether // any of the range variables are locks. func checkCopyLocksRange(pass *analysis.Pass, r *ast.RangeStmt) { … } func checkCopyLocksRangeVar(pass *analysis.Pass, rtok token.Token, e ast.Expr) { … } type typePath … // String pretty-prints a typePath. func (path typePath) String() string { … } func lockPathRhs(pass *analysis.Pass, x ast.Expr) typePath { … } // lockPath returns a typePath describing the location of a lock value // contained in typ. If there is no contained lock, it returns nil. // // The seen map is used to short-circuit infinite recursion due to type cycles. func lockPath(tpkg *types.Package, typ types.Type, seen map[types.Type]bool) typePath { … } // parent returns the second from the last node on stack if it exists. func parent(stack []ast.Node) ast.Node { … } var lockerType … // Construct a sync.Locker interface type. func init() { … }