if a < b { return a } return b } func main() { fmt.Println(Min[int](5, 2)) fmt.Println(Min[float64](3.1, 9.7)) } https://go.dev/play/p/uCZq2OnksPK 型パラメータ 型引数
go generics for the busy gophers ◦ https://sethops1.net/post/go-generics-for-the-busy-gopher/ • Go 言語にやってくる Generics は我々に何をもたらすのか ◦ https://zenn.dev/mattn/books/4c7de85ec42cb44cf285 • Go 1.18集中連載 ジェネリクス ◦ https://future-architect.github.io/articles/20220209a/
Sets" proposal を読む ◦ https://zenn.dev/nobishii/articles/99a2b55e2d3e50 • What's new in Go 1.18? ◦ https://speakerdeck.com/syumai/whats-new-in-go-1-dot-18