From f11a3cd58fd937d8ab4e773b6db0296246b0d8da Mon Sep 17 00:00:00 2001 From: Stephen Augustus Date: Fri, 13 Aug 2021 10:25:08 -0400 Subject: [PATCH] hack/boilerplate: Tolerate new build tag format (`//go:build`) Signed-off-by: Stephen Augustus --- hack/boilerplate/boilerplate.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/hack/boilerplate/boilerplate.py b/hack/boilerplate/boilerplate.py index 5a6d3177eb1..f082266aa8b 100755 --- a/hack/boilerplate/boilerplate.py +++ b/hack/boilerplate/boilerplate.py @@ -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)"; # 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"^(// \+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