Skip to content

Commit f62cd3d

Browse files
authored
cmd/goal: refactor to use typeparam (#6413)
1 parent 242cc03 commit f62cd3d

File tree

1 file changed

+3
-11
lines changed

1 file changed

+3
-11
lines changed

cmd/goal/interact.go

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ type appInteractDatum interface {
8080
pseudo() bool
8181
}
8282

83-
func helpList(help map[string]appInteractDatum) string {
83+
func helpList[V appInteractDatum](help map[string]V) string {
8484
largestName := 0
8585
largestKind := 0
8686
for k, v := range help {
@@ -286,11 +286,7 @@ func (sch appInteractSchema) validate() (err error) {
286286
}
287287

288288
func (sch appInteractSchema) EntryList() string {
289-
help := make(map[string]appInteractDatum)
290-
for k, v := range sch {
291-
help[k] = v
292-
}
293-
return helpList(help)
289+
return helpList(sch)
294290
}
295291

296292
func (sch appInteractSchema) EntryNames() (names []string) {
@@ -434,11 +430,7 @@ func (hdr appInteractHeader) validate() (err error) {
434430
}
435431

436432
func (hdr appInteractHeader) ProcList() string {
437-
help := make(map[string]appInteractDatum)
438-
for k, v := range hdr.Execute {
439-
help[k] = v
440-
}
441-
return helpList(help)
433+
return helpList(hdr.Execute)
442434
}
443435

444436
func (hdr appInteractHeader) ProcNames() (names []string) {

0 commit comments

Comments
 (0)