Skip to content

Commit 35383bb

Browse files
committed
example preload to include both sigs and wg
1 parent 626863f commit 35383bb

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

pkg/kepval/keps/validations/yaml.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ func (m *MustHaveAtLeastOneValue) Error() string {
8686
return fmt.Sprintf("%q must have at least one value", m.key)
8787
}
8888

89-
var listSIGs []string
89+
var listSIGsAndWGs []string
9090

9191
func init() {
9292
resp, err := http.Get("https://raw.githubusercontent.com/kubernetes/community/master/sigs.yaml")
@@ -95,20 +95,20 @@ func init() {
9595
os.Exit(1)
9696
}
9797
defer resp.Body.Close()
98-
re := regexp.MustCompile(`- dir: sig-(.*)$`)
98+
re := regexp.MustCompile(`- dir: (.*)$`)
9999

100100
scanner := bufio.NewScanner(resp.Body)
101101
for scanner.Scan() {
102102
match := re.FindStringSubmatch(scanner.Text())
103103
if len(match)>0 {
104-
listSIGs = append(listSIGs, "sig-" + match[1])
104+
listSIGsAndWGs = append(listSIGsAndWGs, match[1])
105105
}
106106
}
107107
if err := scanner.Err(); err != nil {
108108
fmt.Fprintf(os.Stderr, "unable to scan list of sigs: %v", err)
109109
os.Exit(1)
110110
}
111-
sort.Strings(listSIGs)
111+
sort.Strings(listSIGsAndWGs)
112112
}
113113

114114
var mandatoryKeys = []string{"title", "owning-sig"}
@@ -147,9 +147,9 @@ func ValidateStructure(parsed map[interface{}]interface{}) error {
147147
return &ValueMustBeString{k, v}
148148
}
149149
v, _ := value.(string)
150-
index := sort.SearchStrings(listSIGs, v)
151-
if index >= len(listSIGs) || listSIGs[index] != v {
152-
return &ValueMustBeOneOf{k, v, listSIGs}
150+
index := sort.SearchStrings(listSIGsAndWGs, v)
151+
if index >= len(listSIGsAndWGs) || listSIGsAndWGs[index] != v {
152+
return &ValueMustBeOneOf{k, v, listSIGsAndWGs}
153153
}
154154
// optional strings
155155
case "editor":

0 commit comments

Comments
 (0)