@@ -163,19 +163,29 @@ type Group struct {
163
163
Name string
164
164
MissionStatement FoldedString `yaml:"mission_statement,omitempty"`
165
165
CharterLink string `yaml:"charter_link,omitempty"`
166
- StakeholderSIGs []string `yaml:"stakeholder_sigs,omitempty"`
166
+ StakeholderSIGs []SIGName `yaml:"stakeholder_sigs,omitempty"`
167
167
Label string
168
168
Leadership LeadershipGroup `yaml:"leadership"`
169
169
Meetings []Meeting
170
170
Contact Contact
171
171
Subprojects []Subproject `yaml:",omitempty"`
172
172
}
173
173
174
+ type SIGName string
175
+
176
+ func (n SIGName ) DirName () string {
177
+ return DirName ("sig" , string (n ))
178
+ }
179
+
174
180
// DirName returns the directory that a group's documentation will be
175
181
// generated into. It is composed of a prefix (sig for SIGs and wg for WGs),
176
182
// and a formatted version of the group's name (in kebab case).
177
183
func (g * Group ) DirName (prefix string ) string {
178
- return fmt .Sprintf ("%s-%s" , prefix , strings .ToLower (strings .Replace (g .Name , " " , "-" , - 1 )))
184
+ return DirName (prefix , g .Name )
185
+ }
186
+
187
+ func DirName (prefix , name string ) string {
188
+ return fmt .Sprintf ("%s-%s" , prefix , strings .ToLower (strings .Replace (name , " " , "-" , - 1 )))
179
189
}
180
190
181
191
// LabelName returns the expected label for a given group
@@ -217,7 +227,9 @@ func (c *Context) Sort() {
217
227
return groups [i ].Dir < groups [j ].Dir
218
228
})
219
229
for _ , group := range groups {
220
- sort .Strings (group .StakeholderSIGs )
230
+ sort .Slice (group .StakeholderSIGs , func (i , j int ) bool {
231
+ return group .StakeholderSIGs [i ] < group .StakeholderSIGs [j ]
232
+ })
221
233
for _ , people := range [][]Person {
222
234
group .Leadership .Chairs ,
223
235
group .Leadership .TechnicalLeads ,
@@ -285,7 +297,7 @@ func (c *Context) Validate() []error {
285
297
if len (group .StakeholderSIGs ) != 0 {
286
298
if prefix == "wg" {
287
299
for _ , name := range group .StakeholderSIGs {
288
- if index (c .Sigs , func (g Group ) bool { return g .Name == name }) == - 1 {
300
+ if index (c .Sigs , func (g Group ) bool { return g .Name == string ( name ) }) == - 1 {
289
301
errors = append (errors , fmt .Errorf ("%s: invalid stakeholder sig name %s" , group .Dir , name ))
290
302
}
291
303
}
0 commit comments