Here's an alternative Go generics syntax that uses the familiar <> but avoids parsing complexity by placing it to the left of the identifier. It's a bit (very?) unusual, but has the benefits of brevity and making the type parameters stand out.
Illustrated by converting some examples from Generics — Problem Overview :
type <T>List []T
func <K, V>Keys(m map[K]V) []K
var ints <int>List
keys := <int, string>Keys(map[int]string{1: "one", 2: "two"})
type <T Equal>Set []T
func (s <T>Set) Find(x T) int {
...
}
I believe you have an additional paren on the 4th line. My guess is that you meant: