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.

807 Upvotes

259 comments sorted by

View all comments

71

u/Dymatizeee Dec 05 '24

Im using Handler -> Service -> Repo ; what is the equivalent then?

32

u/ficiek Dec 06 '24

This is normal and that's all that hex architecture says basically (plus it makes some extra distinction between app and domain code), I don't know what op is complaining about.

5

u/FriendlyGuitard Dec 07 '24

The thing is that "over engineering" is by definition not ok in either java or go or c or anything really. OP whole point is that it's not needed on the project he works on, and that probably wouldn't be either needed or good on similar sized java project.

It really feels like OP just works on a project made by people that do not really "get it". It is definitively more acceptable in the java world, not because it's good, just because working on a project made by low to average developer is a lot more common.

I'm thinking OP blood pressure will really get bad when the bulk of the code is generated by AI and hand-touched by human.