Skip to content

Commit 221803a

Browse files
authored
fix: related information position (#5746)
1 parent 7326c96 commit 221803a

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

pkg/goanalysis/runners.go

+7-1
Original file line numberDiff line numberDiff line change
@@ -136,10 +136,16 @@ func buildIssues(diags []Diagnostic, linterNameBuilder func(diag *Diagnostic) st
136136

137137
if len(diag.Related) > 0 {
138138
for _, info := range diag.Related {
139+
relatedPos := diag.Pkg.Fset.Position(info.Pos)
140+
141+
if relatedPos.Filename != diag.Position.Filename {
142+
relatedPos = diag.Position
143+
}
144+
139145
issues = append(issues, result.Issue{
140146
FromLinter: linterName,
141147
Text: fmt.Sprintf("%s(related information): %s", diag.Analyzer.Name, info.Message),
142-
Pos: diag.Pkg.Fset.Position(info.Pos),
148+
Pos: relatedPos,
143149
Pkg: diag.Pkg,
144150
})
145151
}

0 commit comments

Comments
 (0)