Merge pull request #16390 from justinsb/update_boilerplate_py

chore: update boilerplate.py to recognize new build tags
This commit is contained in:
Kubernetes Prow Robot 2024-02-28 10:32:45 -08:00 committed by GitHub
commit 68c500cf83
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 9 additions and 6 deletions

View File

@ -213,20 +213,23 @@ def get_dates():
def get_regexs():
regexs = {}
# Search for "YEAR" which exists in the boilerplate, but shouldn't in the real thing
regexs["year"] = re.compile('YEAR')
# get_dates return 2014, 2015, 2016, 2017, or 2018 until the current year as a regex like: "(2014|2015|2016|2017|2018)";
regexs["year"] = re.compile("YEAR")
# 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
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(
r"^(//go:build.*\n// \+build.*\n)+\n", re.MULTILINE)
r"^(//(go:build| \+build).*\n)+\n", re.MULTILINE
)
# strip #!.* from scripts
regexs["shebang"] = re.compile(r"^(#!.*\n)\n*", re.MULTILINE)
# Search for generated files
regexs["generated"] = re.compile('DO NOT EDIT')
regexs["generated"] = re.compile(r"^[/*#]+ +.* DO NOT EDIT\.$", re.MULTILINE)
return regexs
def main():
regexs = get_regexs()
refs = get_refs()