Skip to content

Commit

Permalink
trying to fix the repalcement section
Browse files Browse the repository at this point in the history
  • Loading branch information
ldez committed Feb 19, 2023
1 parent e43501b commit 41a1b2b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pkg/golinters/gocritic.go
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ func runGocriticOnFile(linterCtx *gocriticlinter.Context, f *ast.File, checks []
// All checkers are expected to use *lint.Context
// as read-only structure, so no copying is required.
for _, warn := range c.Check(f) {
pos := linterCtx.FileSet.Position(warn.Node.Pos())
pos := linterCtx.FileSet.Position(warn.Pos)
issue := result.Issue{
Pos: pos,
Text: fmt.Sprintf("%s: %s", c.Info.Name, warn.Text),
Expand All @@ -184,7 +184,7 @@ func runGocriticOnFile(linterCtx *gocriticlinter.Context, f *ast.File, checks []
issue.Replacement = &result.Replacement{
Inline: &result.InlineFix{
StartCol: pos.Column - 1,
Length: int(warn.Node.End() - warn.Node.Pos()),
Length: int(warn.Suggestion.From - warn.Suggestion.To),
NewString: string(warn.Suggestion.Replacement),
},
}
Expand Down

0 comments on commit 41a1b2b

Please sign in to comment.