diff --git a/hack/verify_boilerplate.py b/hack/verify_boilerplate.py index 98fb27b5c..412e4d22b 100755 --- a/hack/verify_boilerplate.py +++ b/hack/verify_boilerplate.py @@ -22,6 +22,7 @@ from __future__ import print_function import argparse +import datetime import glob import os import re @@ -176,13 +177,16 @@ def get_files(extensions): outfiles.append(pathname) return outfiles +def get_dates(): + years = datetime.datetime.now().year + return '(%s)' % '|'.join((str(year) for year in range(2014, years+1))) def get_regexs(): regexs = {} # Search for "YEAR" which exists in the boilerplate, but shouldn't in the real thing regexs["year"] = re.compile('YEAR') # dates can be 2014, 2015, 2016 or 2017, company holder names can be anything - regexs["date"] = re.compile('(2014|2015|2016|2017|2018|2019|2020|2021|2022|2023|2024)') + regexs["date"] = re.compile(get_dates()) # strip // +build \n\n build constraints regexs["go_build_constraints"] = re.compile( r"^(// \+build.*\n)+\n", re.MULTILINE)