in pkg/header/fix.go [103:129]
func GenerateLicenseHeader(style *comments.CommentStyle, config *ConfigHeader) (string, error) {
if err := style.Validate(); err != nil {
return "", err
}
content := config.GetLicenseContent()
// Trim leading and trailing newlines
content = strings.TrimSpace(content)
lines := strings.Split(content, "\n")
for i, line := range lines {
if line != "" {
lines[i] = fmt.Sprintf("%v %v", style.Middle, line)
} else {
lines[i] = style.Middle
}
}
if style.Start != style.Middle {
lines = append([]string{style.Start}, lines...)
}
if style.End != style.Middle {
lines = append(lines, style.End)
}
return strings.Join(lines, "\n") + "\n\n", nil
}