Go 1.18 generics use cases

What are generics?

See Type Parameters Proposal.

How to run the examples?

As of today, gotip is the simplest way to run the examples in the repo.

After installing gotip, you can run the examples as usual Go code:

$ gotip test -v ./...
=== RUN   ExampleEqual
--- PASS: ExampleEqual (0.00s)
PASS
ok  	github.com/narqo/test-go-generics/assert	0.123s
=== RUN   ExampleIterator_sliceIterator
--- PASS: ExampleIterator_sliceIterator (0.00s)
=== RUN   ExampleIterator_csvIterator
--- PASS: ExampleIterator_csvIterator (0.00s)
PASS
ok  	github.com/narqo/test-go-generics/iter	0.197s

License

MIT

GitHub

View Github