File tree 1 file changed +13
-4
lines changed
1 file changed +13
-4
lines changed Original file line number Diff line number Diff line change @@ -91,16 +91,25 @@ func runGoHeader(pass *analysis.Pass, conf *goheader.Configuration) error {
91
91
}
92
92
93
93
if fix := issue .Fix (); fix != nil {
94
- end := len (fix .Actual )
94
+ current := len (fix .Actual )
95
95
for _ , s := range fix .Actual {
96
- end += len (s )
96
+ current += len (s )
97
+ }
98
+
99
+ end := start + token .Pos (current )
100
+
101
+ header := strings .Join (fix .Expected , "\n " ) + "\n "
102
+
103
+ // Adds an extra line between the package and the header.
104
+ if end == file .Package {
105
+ header += "\n "
97
106
}
98
107
99
108
diag .SuggestedFixes = []analysis.SuggestedFix {{
100
109
TextEdits : []analysis.TextEdit {{
101
110
Pos : start ,
102
- End : start + token . Pos ( end ) ,
103
- NewText : []byte (strings . Join ( fix . Expected , " \n " ) + " \n " ),
111
+ End : end ,
112
+ NewText : []byte (header ),
104
113
}},
105
114
}}
106
115
}
You can’t perform that action at this time.
0 commit comments