Skip to content

Commit 2cef146

Browse files
committed
lintcmd: panic with the right message when we can't parse a position
(cherry picked from commit 4a7ea0e)
1 parent 0636bca commit 2cef146

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lintcmd/lint.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -456,7 +456,7 @@ func failed(res runner.Result) []diagnostic {
456456
var err error
457457
posn, _, err = parsePos(e.Pos)
458458
if err != nil {
459-
panic(fmt.Sprintf("internal error: %s", e))
459+
panic(fmt.Sprintf("internal error: %s", err))
460460
}
461461
}
462462
diag := diagnostic{
@@ -558,7 +558,7 @@ func parsePos(pos string) (token.Position, int, error) {
558558
}
559559
parts := posRe.FindStringSubmatch(pos)
560560
if parts == nil {
561-
return token.Position{}, 0, fmt.Errorf("internal error: malformed position %q", pos)
561+
return token.Position{}, 0, fmt.Errorf("malformed position %q", pos)
562562
}
563563
file := parts[1]
564564
line, _ := strconv.Atoi(parts[2])

0 commit comments

Comments
 (0)