Some notes on Go error handling, FP and railway programming


These last months I've had the chance to implement some new microservices with the Social Point backend team. We have taken advantadge of some Go functional programming features to be more expressive when modeling our domain and be able to apply some techniques to make the code base simpler to understand, like implementing middlewares to decouple the domain logic from logging or tracing.

On the other hand, last year I attended Software Craftmanship BCN '16 conf and one of the talks I liked most was named Railway programming: all aboard! by Ignasi Marimon-Clos (thank you @ignasi35!) which explained how to use certain features found in some functional languages to avoid repeating error handling code bits all over your code base.

So with that in mind I tried to dive a little bit more in those concepts and I wrote some notes and references in this hackmd document to gather together techniques to apply this kind of approach when programming in Go.

I hope you find them interesting.