Here we go, I brought in some actual code hot off the press.
self.query(db.Unified_Doc.id)
.filter(self.restrictor)
.filter(and_titles(q.name))
.filter(db.Unified_Doc.id.in_(list(matches)))
.all()
This is a pretty basic database query from Python’s SQLAlchemy, a top-quality library that transparently lets you use almost any SQL database with a clean, functional syntax.
Even without knowing SQLAlchemy, it’s fairly clear what it’s doing — you start a query, filter it by some restrictor, then by a collection of titles, then by a collection of IDs.
There are eight different statements in that block that could raise an exception — one for each opening parenthesis.
I can’t see how you could do this in Go in less than 24 lines, 16 of which would be error handling.
Would all those repetitive error checks really make the structure of what’s going on clearer than the?