Merge pull request #4715 from SgtCoDFish/gobuildboilerplate

Match upstream boilerplate verification for files w/ go:build
This commit is contained in:
jetstack-bot 2022-01-06 16:01:22 +00:00 committed by GitHub
commit a29cf92ae4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -192,13 +192,11 @@ 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 //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
# 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 shell/python scripts
regexs["shebang"] = re.compile(r"^(#!.*\n)\n*", re.MULTILINE)
return regexs