Skip to content

Commit 9a265de

Browse files
committed
trying to fix the replacement section
1 parent e43501b commit 9a265de

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

pkg/golinters/gocritic.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ func runGocriticOnFile(linterCtx *gocriticlinter.Context, f *ast.File, checks []
173173
// All checkers are expected to use *lint.Context
174174
// as read-only structure, so no copying is required.
175175
for _, warn := range c.Check(f) {
176-
pos := linterCtx.FileSet.Position(warn.Node.Pos())
176+
pos := linterCtx.FileSet.Position(warn.Pos)
177177
issue := result.Issue{
178178
Pos: pos,
179179
Text: fmt.Sprintf("%s: %s", c.Info.Name, warn.Text),
@@ -184,7 +184,7 @@ func runGocriticOnFile(linterCtx *gocriticlinter.Context, f *ast.File, checks []
184184
issue.Replacement = &result.Replacement{
185185
Inline: &result.InlineFix{
186186
StartCol: pos.Column - 1,
187-
Length: int(warn.Node.End() - warn.Node.Pos()),
187+
Length: int(warn.Suggestion.To - warn.Suggestion.From),
188188
NewString: string(warn.Suggestion.Replacement),
189189
},
190190
}

0 commit comments

Comments
 (0)