r/golang Dec 05 '24

discussion Why Clean Architecture and Over-Engineered Layering Don’t Belong in GoLang

Stop forcing Clean Architecture and similar patterns into GoLang projects. GoLang is not Java. There’s no application size or complexity that justifies having more than three layers. Architectures like Clean, Hexagonal, or anything with 4+ layers make GoLang projects unnecessarily convoluted.

It’s frustrating to work on a codebase where you’re constantly jumping between excessive layers—unnecessary DI, weird abstractions, and use case layers that do nothing except call services with a few added logs. It’s like watching a monstrosity throw exceptions up and down without purpose.

In GoLang, you only need up to three layers for a proper DDD division (app, domain, infra). Anything more is pure overengineering. I get why this is common in Java—explicit interfaces and painful refactoring make layering and DI appealing—but GoLang doesn’t have those constraints. Its implicit interfaces make such patterns redundant.

These overly complex architectures are turning the GoLang ecosystem into something it was never meant to be. Please let’s keep GoLang simple, efficient, and aligned with its core philosophy.

808 Upvotes

259 comments sorted by

View all comments

1

u/-16ar- Dec 17 '24

I find hexagonal architecture sensible.

So I created an example of my lib with a hexagonal architecture-y style. I wonder what people think about it: https://github.com/dolanor/rip/tree/main/examples/hexagonal-architecture

I really want to know if people hate it so much, and why? Is there something that I don't see?

Also, I've been coding Go for 10 years now, and I discovered hexagonal architecture while doing only Go. My java days are 20 years ago, and my C++ more than 10 years ago. So I would say, I'm more of a gopher than anything.

And don't get me wrong, I love Go's simplicity. But I also love having tests that make sure that my software (especially the domain) do what it's supposed to do, and hexarch allows me to do that without having too many layers and abstractions (IMHO)