Skip to content

Commit ef6ead8

Browse files
authored
godox: trim filepath from report messages (#5977)
1 parent fdee49b commit ef6ead8

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

pkg/golinters/godox/godox.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,14 @@ func run(pass *analysis.Pass, settings *config.GodoxSettings) error {
4444
ft := pass.Fset.File(file.Pos())
4545

4646
for _, i := range messages {
47+
msg := strings.TrimRight(i.Message, "\n")
48+
49+
// https://github.com/matoous/godox/blob/1d6ac9d899726279072e1c4d2b10f1eb52f22878/godox.go#L56
50+
index := strings.Index(msg, "Line contains")
51+
4752
pass.Report(analysis.Diagnostic{
4853
Pos: ft.LineStart(goanalysis.AdjustPos(i.Pos.Line, nonAdjPosition.Line, position.Line)) + token.Pos(i.Pos.Column),
49-
Message: strings.TrimRight(i.Message, "\n"),
54+
Message: msg[index:],
5055
})
5156
}
5257
}

0 commit comments

Comments
 (0)