Skip to main content
Journey Uncommon Logo
JourneyUncommon
mediumGotype constraints and comparableSingle-choice MCQ

Since Go 1.20, instantiating a generic type with an interface type argument under a comparable constraint behaves how?

func Keys[K comparable, V any](m map[K]V) []K { out := make([]K, 0, len(m)) for k := range m { out = append(out, k) } return out } // Keys[any, int](...)