Use xerrors everywhere! It provides additional stacktrace info! nolint:unused,deadcode,varnamelen
(m dsl.Matcher)
| 108 | // |
| 109 | //nolint:unused,deadcode,varnamelen |
| 110 | func xerrors(m dsl.Matcher) { |
| 111 | m.Import("errors") |
| 112 | m.Import("fmt") |
| 113 | m.Import("golang.org/x/xerrors") |
| 114 | |
| 115 | m.Match("fmt.Errorf($arg)"). |
| 116 | Suggest("xerrors.New($arg)"). |
| 117 | Report("Use xerrors to provide additional stacktrace information!") |
| 118 | |
| 119 | m.Match("fmt.Errorf($arg1, $*args)"). |
| 120 | Suggest("xerrors.Errorf($arg1, $args)"). |
| 121 | Report("Use xerrors to provide additional stacktrace information!") |
| 122 | |
| 123 | m.Match("errors.$_($msg)"). |
| 124 | Where(m["msg"].Type.Is("string")). |
| 125 | Suggest("xerrors.New($msg)"). |
| 126 | Report("Use xerrors to provide additional stacktrace information!") |
| 127 | } |
| 128 | |
| 129 | // databaseImport enforces not importing any database types into /codersdk. |
| 130 | // |