Menu

1 / 2

We Killed `interface{}` From a Go Codebase. Here's What Replaced It

DEV Community·Gabriel Anhaia·7 months ago
#gADqVoUS
#bucket#go#generics#refactoring#type
Reading 0:00
15s threshold

Book: Hexagonal Architecture in Go

Also by me: Thinking in Go (2-book series) — Complete Guide to Go Programming + Hexagonal Architecture in Go

My project: Hermes IDE | GitHub — an IDE for developers who ship with Claude Code and other AI coding tools

Me: xgabriel.com | GitHub

A team I worked with last quarter ran a one-line audit on their

backend repo:

git grep -nE 'interface\{\}|\bany\b' -- '*.go' | wc -l

Enter fullscreen mode

Exit fullscreen mode

The number came back at 213. A backend that had grown from a Go

1.16 codebase, through the 1.18 generics release, into the

any alias era, with nobody ever going back to clean up. Some

of those 213 hits were honest: JSON unmarshal targets,

fmt.Sprintf arguments, a logger that took variadic context

fields. Most were not.

You probably have the same audit waiting in your repo.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.