File tree 1 file changed +7
-1
lines changed
1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -81,12 +81,18 @@ func runGoHeader(pass *analysis.Pass, conf *goheader.Configuration) error {
81
81
// Inspired by https://github.com/denis-tingaikin/go-header/blob/4c75a6a2332f025705325d6c71fff4616aedf48f/analyzer.go#L85-L92
82
82
if len (file .Comments ) > 0 && file .Comments [0 ].Pos () < file .Package {
83
83
if ! strings .HasPrefix (file .Comments [0 ].List [0 ].Text , "/*" ) {
84
- // When the comment are "//" there is a one character offset.
84
+ // When the comment is "//" there is a one character offset.
85
85
offset = 1
86
86
}
87
87
commentLine = goanalysis .GetFilePositionFor (pass .Fset , file .Comments [0 ].Pos ()).Line
88
88
}
89
89
90
+ // Skip issues related to build directives.
91
+ // https://github.com/denis-tingaikin/go-header/issues/18
92
+ if issue .Location ().Position - offset < 0 {
93
+ continue
94
+ }
95
+
90
96
diag := analysis.Diagnostic {
91
97
Pos : f .LineStart (issue .Location ().Line + 1 ) + token .Pos (issue .Location ().Position - offset ), // The position of the first divergence.
92
98
Message : issue .Message (),
You can’t perform that action at this time.
0 commit comments