Example code for Go generics
Go to file
2022-12-06 17:02:23 +09:00
add Update to use type sets 2021-10-10 18:22:19 -04:00
anonymous-func Add anonymous-func 2021-11-28 00:35:16 +09:00
benchmark Fix benchmark 2022-01-24 10:48:44 +09:00
binary-size Add binary-size comparing 2021-11-28 00:57:07 +09:00
byteseq Add byteseq 2022-01-10 22:26:24 +09:00
comparable go fmt ./... 2021-09-25 00:34:38 +09:00
constraints-chan Add README.md 2022-02-03 13:04:18 +09:00
constraints-slice fix constraints-slice 2022-03-03 10:39:23 +09:00
constraints-vector Add README.md 2022-02-03 13:04:18 +09:00
every add some and every 2022-03-13 18:30:25 +01:00
exp_maps Add exp_maps 2021-11-28 22:17:13 +09:00
exp_slices Add exp_slices 2021-11-28 23:01:11 +09:00
filter go fmt ./... 2021-09-25 00:34:38 +09:00
foreach go fmt ./... 2021-09-25 00:34:38 +09:00
functional-options Add functional-options 2021-11-28 00:33:31 +09:00
generator Update to use type sets 2021-10-10 18:22:19 -04:00
interface function name change 2021-12-22 10:13:06 -05:00
list Fix: list, fix InsertAt 2022-12-06 14:37:09 +08:00
map go fmt ./... 2021-09-25 00:34:38 +09:00
minmax Update to use type sets 2021-10-10 18:22:19 -04:00
must Add must 2021-10-03 21:56:07 +09:00
perm go fmt ./... 2021-09-25 00:34:38 +09:00
pointerof go fmt ./... 2021-09-25 00:34:38 +09:00
reduce Use generic type instead of interface{} 2021-12-31 17:28:05 +08:00
reflect Add reflect 2021-11-28 00:36:37 +09:00
shuffle go fmt ./... 2021-09-25 00:34:38 +09:00
some add some and every 2022-03-13 18:30:25 +01:00
splittraintest go fmt ./... 2021-09-25 00:34:38 +09:00
ternaryop fix typo 2021-03-24 02:25:00 +08:00
tuple Fix 2022-05-08 00:41:01 +09:00
underlying Add underlying 2021-11-27 10:28:22 +09:00
uniq Add uniq 2022-03-02 00:55:09 +09:00
.gitignore Separate examples 2021-03-21 23:25:54 +09:00
build.sh Add build.sh 2022-03-13 21:46:16 +09:00
go.mod Fix 2021-08-17 22:47:18 +09:00
README.md Add linq as third-party package 2022-04-23 22:16:00 +09:00

go-generics-example

Example code for Go generics.

Usage

$ go build -gcflags=-G=3

Requirements

Go 1.18 or later

Third-party packages that support Generics

  • Code-Hex/go-generics-cache An in-memory key:value store/cache library written in Go 1.18 generics
  • genkami/dogs Dogs is a library that provides some useful types and functions borrowed from functional languages.
  • makiuchi-d/tuple Definition of n-tuple structs using type parameters.
  • samber/lo 💥 A Lodash-style Go library based on Go 1.18+ Generics (map, filter, contains, find...)
  • mattn/go-result Something like unwrap in Rust.
  • makiuchi-d/linq LINQ for Go with type parameters.

Advertise

Go 言語にやってくる Generics は我々に何をもたらすのか

License

MIT

Author

Yasuhiro Matsumoto (a.k.a. mattn)