Go streams (a look at what is possible with generics)

This page summarizes the projects mentioned and recommended in the original post on /r/golang

Our great sponsors
  • WorkOS - The modern identity platform for B2B SaaS
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • SaaSHub - Software Alternatives and Reviews
  • genesis

    All generic functions for Go you ever need! (by life4)

  • I faced the same issue when migrating genesis from code generation to generics. Before it used to have the same streaming API as you describe but now I decided to go with functional API. That means, you basically "pipe" data with temporary variables. So your last example would look something like this:

  • go

    The Go programming language

  • Yes, it requires you to come up with more variable names but it doesn't make code much longer or less readable. The proposal add elixir-like pipe operator has a long discussion on the subject. That said, I'm still trying to figure out if it is possible to implement with generics some kind of pipe or lenses.

  • WorkOS

    The modern identity platform for B2B SaaS. The APIs are flexible and easy-to-use, supporting authentication, user identity, and complex enterprise features like SSO and SCIM provisioning.

    WorkOS logo
  • iter

    Experimental lazy iterator library to test the capabilities of go generics in 1.18 (by urandom)

  • Came to pretty similar conclusions regarding the ergonomics myself: https://github.com/urandom/iter/blob/main/README.md

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts