Saturday, March 12, 2022

go generics

 go generics for the busy gopher

  • Go 1.18 introduces generics to the language

func min(a, b int) int { if a < b { return a } return b }

=>

func min[T constraints.Ordered](a, b T) T { if a < b { return a } return b }

Getting Started with Generics in Go - YouTube


Golang Weekly Issue 399: February 11, 2022

No comments: