Menu

Post image 1
Post image 2
Post image 3
1 / 3
0

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

DEV Community·Gabriel Anhaia·about 1 month ago
#gADqVoUS
#bucket#go#generics#refactoring#type#string
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. The team grouped the 213 hits into three buckets and replaced almost all of them with code that the compiler can actually check.…

Continue reading — create a free account

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

Read More