File tree Expand file tree Collapse file tree 1 file changed +10
-10
lines changed Expand file tree Collapse file tree 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 {
7676
7777 f := pass .Fset .File (file .Pos ())
7878
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-
8879 diag := analysis.Diagnostic {
89- Pos : start ,
80+ Pos : f . LineStart ( issue . Location (). Line + 1 ), // The position of the first divergence.
9081 Message : issue .Message (),
9182 }
9283
@@ -96,6 +87,15 @@ func runGoHeader(pass *analysis.Pass, conf *goheader.Configuration) error {
9687 current += len (s )
9788 }
9889
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+
9999 end := start + token .Pos (current )
100100
101101 header := strings .Join (fix .Expected , "\n " ) + "\n "
You can’t perform that action at this time.
0 commit comments