From 577757f2823e84e72d7ba830d7ef5db8a6ba7cd6 Mon Sep 17 00:00:00 2001 From: irbekrm Date: Mon, 27 Sep 2021 12:08:39 +0100 Subject: [PATCH] Adds the new format of Go build tags to verify_boilerplate Signed-off-by: irbekrm --- hack/verify_boilerplate.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/hack/verify_boilerplate.py b/hack/verify_boilerplate.py index f199fd5af..f95aeb793 100755 --- a/hack/verify_boilerplate.py +++ b/hack/verify_boilerplate.py @@ -192,9 +192,13 @@ def get_regexs(): regexs["year"] = re.compile('YEAR') # dates can be 2014, 2015, 2016 or 2017, company holder names can be anything regexs["date"] = re.compile(get_dates()) - # strip // +build \n\n build constraints + # strip //go:build \n// +build \n\n build constraints We are currently using + # Go 1.17 where two forms of build constraints ('go:build', '+build') are + # added to files. This will need to change when we upgrade to a version of + # Go which only uses the 'go:build' format + # See https://go.googlesource.com/proposal/+/master/design/draft-gobuild.md regexs["go_build_constraints"] = re.compile( - r"^(// \+build.*\n)+\n", re.MULTILINE) + r"^(//go:build.*\n// \+build.*\n)+\n", re.MULTILINE) # strip #!.* from shell/python scripts regexs["shebang"] = re.compile(r"^(#!.*\n)\n*", re.MULTILINE) return regexs