3 ms·
As a fan of Go the only really thing I’m missing is a better way to work with data. Something like LINQ probably wont ever be possible with Go but built in sup
by davewritescode 3y ago
As a fan of Go the only really thing I’m missing is a better way to work with data. Something like LINQ probably wont ever be possible with Go but built in support for map/filter/reduce with some handy built in aggregations would make a lot of things simpler to accomplish.
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.
- benhoyt 3y agoThis is a lot more possible now that Go has generics (as of 1.18). 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 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 https://github.com/samber/lo: kind of like JavaScript's lodash library but for Go 1.18+ (with generics) - https://github.com/asynkron/gofun https://github.com/asynkron/gofun: simple library with stand-alone functions to filter, map, and so on