From 0eb8069d49114a3721ebd94ede7c653efadf6a46 Mon Sep 17 00:00:00 2001 From: Prateek Rungta Date: Mon, 8 Oct 2018 15:47:47 -0400 Subject: [PATCH] Allow year update skipping --- update-license/main.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/update-license/main.go b/update-license/main.go index 06668c7..5dc60fa 100644 --- a/update-license/main.go +++ b/update-license/main.go @@ -63,6 +63,8 @@ const ( var ( flagDryRun = flag.Bool("dry", false, "Do not edit files and just print out what files would be edited") + flagSkipYearUpdate = flag.Bool("skip-year-update", true, "Ignore updating header if only change is year") + lineSkipPrefixes = []string{ "// Code generated by", "// @generated", @@ -141,6 +143,9 @@ func updateLines(lines []string, year int) []string { break } if strings.HasPrefix(line, headerPrefix) { + if *flagSkipYearUpdate { + return lines + } lines[i] = headerString(year) return lines }