by davewritescode · 3y ago · 0 comments
I’m not asking for the full Java streams equivalent, it would just be nice to be able to filter a slice or perform basic transformations without having to resort to for loops.
I would probably never use these, as I find such libraries are a whole new domain-specific language to learn, and often don't make things much simpler anyway, but here are some libraries where people have done something like this:
- https://github.com/ahmetb/go-linq: modelled after LINQ, but created pre-generics so only recently added some generics features
- https://github.com/samber/lo: kind of like JavaScript's lodash library but for Go 1.18+ (with generics)
- https://github.com/asynkron/gofun: simple library with stand-alone functions to filter, map, and so on