Skip to content

Commit

Permalink
lintcmd: panic with the right message when we can't parse a position
Browse files Browse the repository at this point in the history
  • Loading branch information
dominikh committed Aug 6, 2024
1 parent d0a0c65 commit 4a7ea0e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lintcmd/lint.go
Original file line number Diff line number Diff line change
Expand Up @@ -456,7 +456,7 @@ func failed(res runner.Result) []diagnostic {
var err error
posn, _, err = parsePos(e.Pos)
if err != nil {
panic(fmt.Sprintf("internal error: %s", e))
panic(fmt.Sprintf("internal error: %s", err))
}
}
diag := diagnostic{
Expand Down Expand Up @@ -558,7 +558,7 @@ func parsePos(pos string) (token.Position, int, error) {
}
parts := posRe.FindStringSubmatch(pos)
if parts == nil {
return token.Position{}, 0, fmt.Errorf("internal error: malformed position %q", pos)
return token.Position{}, 0, fmt.Errorf("malformed position %q", pos)
}
file := parts[1]
line, _ := strconv.Atoi(parts[2])
Expand Down

0 comments on commit 4a7ea0e

Please sign in to comment.