INNER CODE UNIT · Go
verifyBoilerplate
kubernetes-sigs/kwok · hack/verify_boilerplate/main.go:85
func verifyBoilerplate(contents string) error {
idx := 0
foundBoilerplateStart := false
lines := strings.SplitSeq(contents, "\n")
for line := range lines {
// handle leading comments
line = trimLeadingComment(line, "//")
line = trimLeadingComment(line, "#")
// find the start of the boilerplate
bpLine := boilerPlate[idx]
if strings.Contains(line, boilerPlateStart) {
foundBoilerplateStart = true
// validate the year of the copyright
yearWords := strings.Split(line, " ")
if yearRegexp.MatchString(yearWords[1]) {
bpLine = strings.ReplaceAll(bpLine, yearPlaceholder, yearWords[1])