diff --git a/cmd/lq/main.go b/cmd/lq/main.go index 2040ced..76e9faa 100644 --- a/cmd/lq/main.go +++ b/cmd/lq/main.go @@ -4,6 +4,7 @@ import ( "fmt" "log" "os" + "strconv" "strings" "time" @@ -124,15 +125,23 @@ func main() { // fillLicensePlaceholders replaces standard GitHub API placeholders func fillLicensePlaceholders(text, owner string) string { - year := fmt.Sprintf("%d", time.Now().Year()) - - // Standard GitHub placeholders - text = strings.ReplaceAll(text, "[year]", year) - text = strings.ReplaceAll(text, "[fullname]", owner) - - // Common variations found in some raw templates - text = strings.ReplaceAll(text, "", year) - text = strings.ReplaceAll(text, "", owner) + year := strconv.Itoa(time.Now().Year()) + + replacer := strings.NewReplacer( + // Year variants + "[year]", year, + "[yyyy]", year, + "", year, + "{year}", year, + + // Owner/Author variants + "[fullname]", owner, + "[name of copyright owner]", owner, + "", owner, + "", owner, + "", owner, + "[project author]", owner, + ) - return text + return replacer.Replace(text) }