Meta trips

Introducing the error loop

A common point of discussion among Go programmers, especially those new to the language, is how to handle errors.

Rob Pike on the Go blog

Two days ago Rob Pike published the article Errors are values where he promotes an error handling pattern that could help preventing to have a code base cluttered with statements like this

if err != nil {
    return err

I recently discovered an alternative way to deal with this problem and want to share it with you.


Consider functions instead of methods

If you coming from an object oriented programming language you might be inclined create a bunch of methods when working with Go.

In this post I’d like to show how the same can be achieved with simple functions, leading to a better API with smaller packages.


Tour de wrap middlewares

In the last post I wrote about the motivation and the design of the go-on/wrap middleware micro framework.

Now I will do a quick walk through some selected middlewares.


Go middleware stack in 13 LOC

Perfection is Achieved Not When There Is Nothing More to Add, But When There Is Nothing Left to Take Away.

Antoine de Saint-Exupery

Today I proudly present my micro framework for middleware in Go. After seven totally different iterations, I finally settled with a middleware solution that is both small and powerful.