File tree 1 file changed +10
-10
lines changed
1 file changed +10
-10
lines changed Original file line number Diff line number Diff line change @@ -76,17 +76,8 @@ func runGoHeader(pass *analysis.Pass, conf *goheader.Configuration) error {
76
76
77
77
f := pass .Fset .File (file .Pos ())
78
78
79
- commentLine := 1
80
-
81
- // Inspired by https://github.com/denis-tingaikin/go-header/blob/4c75a6a2332f025705325d6c71fff4616aedf48f/analyzer.go#L85-L92
82
- if len (file .Comments ) > 0 && file .Comments [0 ].Pos () < file .Package {
83
- commentLine = goanalysis .GetFilePositionFor (pass .Fset , file .Comments [0 ].Pos ()).Line
84
- }
85
-
86
- start := f .LineStart (commentLine )
87
-
88
79
diag := analysis.Diagnostic {
89
- Pos : start ,
80
+ Pos : f . LineStart ( issue . Location (). Line + 1 ) + token . Pos ( issue . Location (). Position ), // The position of the first divergence.
90
81
Message : issue .Message (),
91
82
}
92
83
@@ -96,6 +87,15 @@ func runGoHeader(pass *analysis.Pass, conf *goheader.Configuration) error {
96
87
current += len (s )
97
88
}
98
89
90
+ commentLine := 1
91
+
92
+ // Inspired by https://github.com/denis-tingaikin/go-header/blob/4c75a6a2332f025705325d6c71fff4616aedf48f/analyzer.go#L85-L92
93
+ if len (file .Comments ) > 0 && file .Comments [0 ].Pos () < file .Package {
94
+ commentLine = goanalysis .GetFilePositionFor (pass .Fset , file .Comments [0 ].Pos ()).Line
95
+ }
96
+
97
+ start := f .LineStart (commentLine )
98
+
99
99
end := start + token .Pos (current )
100
100
101
101
header := strings .Join (fix .Expected , "\n " ) + "\n "
You can’t perform that action at this time.
0 commit comments