optoutLines returns the line numbers that have a comment in the form: //errtrace:skip It may be followed by other text, e.g., //errtrace:skip // for reasons
( fset *token.FileSet, comments []*ast.CommentGroup, )
| 1182 | // |
| 1183 | // //errtrace:skip // for reasons |
| 1184 | func optoutLines( |
| 1185 | fset *token.FileSet, |
| 1186 | comments []*ast.CommentGroup, |
| 1187 | ) map[int]int { |
| 1188 | lines := make(map[int]int) |
| 1189 | for _, cg := range comments { |
| 1190 | if len(cg.List) > 1 { |
| 1191 | // skip multiline comments which are full line comments, not tied to a return. |
| 1192 | continue |
| 1193 | } |
| 1194 | |
| 1195 | c := cg.List[0] |
| 1196 | if _errtraceSkip.MatchString(c.Text) { |
| 1197 | lineNo := fset.Position(c.Pos()).Line |
| 1198 | lines[lineNo] = 0 |
| 1199 | } |
| 1200 | } |
| 1201 | return lines |
| 1202 | } |
| 1203 | |
| 1204 | func nVars(prefix string, n int) []string { |
| 1205 | vars := make([]string, n) |