Skip to main content
Journey Uncommon Logo
JourneyUncommon
mediumGogenerics type parametersSingle-choice MCQ

Why does the type parameter syntax below fail to compile?

func Group[K any, V any](items []V, key func(V) K) map[K][]V { m := make(map[K][]V) for _, v := range items { m[key(v)] = append(m[key(v)], v) } return m }