зеркало из https://github.com/golang/tools.git
ignore end_posn field when not present
This commit is contained in:
Родитель
b9d688bab5
Коммит
9bb63dd381
|
@ -410,20 +410,25 @@ func (tree JSONTree) Add(fset *token.FileSet, id, name string, diags []analysis.
|
|||
}
|
||||
var related []JSONRelatedInformation
|
||||
for _, r := range f.Related {
|
||||
related = append(related, JSONRelatedInformation{
|
||||
relatedInfo := JSONRelatedInformation{
|
||||
Posn: fset.Position(r.Pos).String(),
|
||||
EndPosn: fset.Position(r.End).String(),
|
||||
Message: r.Message,
|
||||
})
|
||||
}
|
||||
if r.End != token.NoPos {
|
||||
relatedInfo.EndPosn = fset.Position(r.End).String()
|
||||
}
|
||||
related = append(related, relatedInfo)
|
||||
}
|
||||
jdiag := JSONDiagnostic{
|
||||
Category: f.Category,
|
||||
Posn: fset.Position(f.Pos).String(),
|
||||
EndPosn: fset.Position(f.End).String(),
|
||||
Message: f.Message,
|
||||
SuggestedFixes: fixes,
|
||||
Related: related,
|
||||
}
|
||||
if f.End != token.NoPos {
|
||||
jdiag.EndPosn = fset.Position(f.End).String()
|
||||
}
|
||||
diagnostics = append(diagnostics, jdiag)
|
||||
}
|
||||
v = diagnostics
|
||||
|
|
|
@ -105,7 +105,6 @@ func _() {
|
|||
"findcall": \[
|
||||
\{
|
||||
"posn": "([/._\-a-zA-Z0-9]+[\\/]fake[\\/])?a/a.go:4:11",
|
||||
"end_posn": "-",
|
||||
"message": "call of MyFunc123\(...\)",
|
||||
"suggested_fixes": \[
|
||||
\{
|
||||
|
@ -131,7 +130,6 @@ func _() {
|
|||
"assign": \[
|
||||
\{
|
||||
"posn": "([/._\-a-zA-Z0-9]+[\\/]fake[\\/])?c/c.go:5:5",
|
||||
"end_posn": "-",
|
||||
"message": "self-assignment of i to i",
|
||||
"suggested_fixes": \[
|
||||
\{
|
||||
|
|
Загрузка…
Ссылка в новой задаче