hack/boilerplate: Tolerate new build tag format (//go:build)

Signed-off-by: Stephen Augustus <foo@auggie.dev>
This commit is contained in:
Stephen Augustus 2021-08-13 10:25:08 -04:00
parent 481cf6fbe7
commit f11a3cd58f
No known key found for this signature in database
GPG Key ID: 5C9566007B24BDA9

View File

@ -216,9 +216,11 @@ def get_regexs():
# get_dates return 2014, 2015, 2016, 2017, or 2018 until the current year as a regex like: "(2014|2015|2016|2017|2018)"; # get_dates return 2014, 2015, 2016, 2017, or 2018 until the current year as a regex like: "(2014|2015|2016|2017|2018)";
# company holder names can be anything # company holder names can be anything
regexs["date"] = re.compile(get_dates()) regexs["date"] = re.compile(get_dates())
# strip // +build \n\n build constraints # strip the following build constraints/tags:
# //go:build
# // +build \n\n
regexs["go_build_constraints"] = re.compile( regexs["go_build_constraints"] = re.compile(
r"^(// \+build.*\n)+\n", re.MULTILINE) r"^(//(go:build| \+build).*\n)+\n", re.MULTILINE)
# strip #!.* from scripts # strip #!.* from scripts
regexs["shebang"] = re.compile(r"^(#!.*\n)\n*", re.MULTILINE) regexs["shebang"] = re.compile(r"^(#!.*\n)\n*", re.MULTILINE)
# Search for generated files # Search for generated files