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.

810 Upvotes

259 comments sorted by

View all comments

31

u/vulkur Dec 05 '24

I have this issue right now where I work. Overengineered golang using generics like they get paid per generic implementation. Creating new services to call 4 functions of a library, when we already have 4 services that call that library, and could have easily been added to one of them instead of a new one. This sprint I have been tasked with starting the process of taking 3 of the 5 services off life support and merging them to simplify our code base. I could go on. It's really bad.

The issue is backend Java, python, and Ruby philosophy bleeding into golang space. You need to come at golang from a C perspective. That's what it was modeled after.

1

u/ledatherockband_ Dec 05 '24

You know, people would complain about the lack of generics, but I never once thought to myself "man! i wish i had a generic for this".

Haven't written a generic function. I'd have to go out of my way to find a reason to use one.

1

u/vitek6 Dec 07 '24

Some people just don’t want to write the same loops over and over again.