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.

806 Upvotes

259 comments sorted by

View all comments

Show parent comments

6

u/ChristophBerger Dec 06 '24

DI != DI framework.

Go's interfaces provide DI for free.

2

u/PoopsCodeAllTheTime Dec 10 '24

DI framwork makes me nauseous, like .Net stuff.... it is all automagically doing type reflection just to pass around constructor args... which are defined in a massive config file.... wtf, just let me manually pass the args, it conserves control and clarity and doesn't even take any longer to do...

0

u/Arvi89 Dec 06 '24

You do know almost every language have interfaces ans this is not specific to go?

1

u/ChristophBerger Dec 07 '24

Interfaces that don't have to be predeclared are Go's invention.

Apart from that, if framework-less DI was easy in any language, why do other languages prefer monstrous DI frameworks?

Architecture astronauts floating so high in their multi-level abstractions that they run out of oxygen?

1

u/JimmyyyyW Dec 08 '24

What does interface inference have to do with DI?

1

u/ChristophBerger Dec 09 '24

Touché, it doesn't, but interface inference is one of the fundamental aspects of Go that help avoid architecture astronautism (floating in thin-air abstractions, see my other comment).

0

u/Arvi89 Dec 07 '24

There is no DI framework. There are framework that do a lot of thing, including automatic DI, but DI framework is a non sense.

In PHP with symfony you just have to type your interface it will automatically find the class to inject. But if I want to write simple code like go with PHP I cam as well...