Posts from 2025
Struct Tags and reflect
reflect reads Go struct tags at runtime. Lookup tells an empty tag from a missing one; reflect is slow and panics, so keep it at startup, off the hot path.
One Responsibility per Layer, and the Discipline It Takes
Each layer should own one job you can state plainly; blur it and debugging becomes guesswork. On over-abstraction, under-abstraction, and when not to abstract.
Error Messages Are Written for the Next Person
A useful error message says what happened, where the boundary was, and where to look next. Write it for whoever gets paged at 2:30 in the morning.
net/http and the Middleware Pattern
Every Go web framework sits on net/http: http.Handler and ServeHTTP are the whole abstraction, and middleware is a closure wrapping a Handler, outermost first.