const Doc … var Analyzer … func run(pass *analysis.Pass) (interface{ … } var errorType … // hasError reports whether the type of e contains the type error. // See containsError, below, for the meaning of "contains". func hasError(pass *analysis.Pass, e ast.Expr) bool { … } // Report whether any type that typ could store and that could be compared is the // error type. This includes typ itself, as well as the types of struct field, slice // and array elements, map keys and elements, and pointers. It does not include // channel types (incomparable), arg and result types of a Signature (not stored), or // methods of a named or interface type (not stored). func containsError(typ types.Type) bool { … }