Skip to content

Commit de5a1b0

Browse files
committed
chore: move parseError function
1 parent 14013e6 commit de5a1b0

File tree

3 files changed

+16
-13
lines changed

3 files changed

+16
-13
lines changed

pkg/goanalysis/pkgerrors/errors.go

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -56,16 +56,3 @@ func BuildIssuesFromIllTypedError(errs []error, lintCtx *linter.Context) ([]resu
5656

5757
return issues, nil
5858
}
59-
60-
func parseError(srcErr packages.Error) (*result.Issue, error) {
61-
pos, err := parseErrorPosition(srcErr.Pos)
62-
if err != nil {
63-
return nil, err
64-
}
65-
66-
return &result.Issue{
67-
Pos: *pos,
68-
Text: srcErr.Msg,
69-
FromLinter: "typecheck",
70-
}, nil
71-
}

pkg/goanalysis/pkgerrors/parse.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,24 @@ import (
66
"go/token"
77
"strconv"
88
"strings"
9+
10+
"github.com/golangci/golangci-lint/pkg/result"
11+
"golang.org/x/tools/go/packages"
912
)
1013

14+
func parseError(srcErr packages.Error) (*result.Issue, error) {
15+
pos, err := parseErrorPosition(srcErr.Pos)
16+
if err != nil {
17+
return nil, err
18+
}
19+
20+
return &result.Issue{
21+
Pos: *pos,
22+
Text: srcErr.Msg,
23+
FromLinter: "typecheck",
24+
}, nil
25+
}
26+
1127
func parseErrorPosition(pos string) (*token.Position, error) {
1228
// file:line(<optional>:colon)
1329
parts := strings.Split(pos, ":")

0 commit comments

Comments
 (0)