File tree Expand file tree Collapse file tree 1 file changed +9
-13
lines changed Expand file tree Collapse file tree 1 file changed +9
-13
lines changed Original file line number Diff line number Diff line change @@ -2,7 +2,6 @@ package godot
2
2
3
3
import (
4
4
"cmp"
5
- "go/token"
6
5
7
6
"github.com/tetafro/godot"
8
7
"golang.org/x/tools/go/analysis"
@@ -60,26 +59,23 @@ func runGodot(pass *analysis.Pass, settings godot.Settings) error {
60
59
return err
61
60
}
62
61
63
- for _ , i := range iss {
64
- f := pass .Fset .File (file .Pos ())
62
+ if len (iss ) == 0 {
63
+ continue
64
+ }
65
65
66
- pos := f . Pos ( i .Pos . Offset )
66
+ f := pass . Fset . File ( file .Pos () )
67
67
68
- var end token.Pos
69
- if i .Pos .Line == f .LineCount () {
70
- // missing newline at the end of the file
71
- end = f .Pos (f .Size ())
72
- } else {
73
- end = f .LineStart (i .Pos .Line + 1 ) - token .Pos (1 )
74
- }
68
+ for _ , i := range iss {
69
+ start := f .Pos (i .Pos .Offset )
70
+ end := goanalysis .EndOfLinePos (f , i .Pos .Line )
75
71
76
72
pass .Report (analysis.Diagnostic {
77
- Pos : pos ,
73
+ Pos : start ,
78
74
End : end ,
79
75
Message : i .Message ,
80
76
SuggestedFixes : []analysis.SuggestedFix {{
81
77
TextEdits : []analysis.TextEdit {{
82
- Pos : pos ,
78
+ Pos : start ,
83
79
End : end ,
84
80
NewText : []byte (i .Replacement ),
85
81
}},
You can’t perform that action at this time.
0 commit comments