We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 65613f3 commit f0e8335Copy full SHA for f0e8335
pkg/golinters/goheader/goheader.go
@@ -72,7 +72,14 @@ func runGoHeader(pass *analysis.Pass, conf *goheader.Configuration) error {
72
73
f := pass.Fset.File(file.Pos())
74
75
- start := f.LineStart(issue.Location().Line + 1)
+ commentLine := 1
76
+
77
+ // Inspired by https://github.com/denis-tingaikin/go-header/blob/4c75a6a2332f025705325d6c71fff4616aedf48f/analyzer.go#L85-L92
78
+ if len(file.Comments) > 0 && file.Comments[0].Pos() < file.Package {
79
+ commentLine = goanalysis.GetFilePositionFor(pass.Fset, file.Comments[0].Pos()).Line
80
+ }
81
82
+ start := f.LineStart(commentLine)
83
84
diag := analysis.Diagnostic{
85
Pos: start,
0 commit comments