Type parameters or Generics in Go designed to reduce boilerplate for container data types like lists, graphs, etc. and functions like map, filter, reduce...
But it's possible to use them in other (I've named them 'unusual') cases. I'm collecting such cases in this repository. What's inside:
- Type to emulate JS 'undefined' for JSON
- Type to deal with non-standard time formats in JSON/XML/etc.
- Function to get pointer from literal in one line
- Generic version of x/sync/singleflight.Group
Feel free to open issue or pull request to add new one.
Note that until 1.18 release documentation on 'pkg.go.dev' will not be rendered.