The controversy of using Clean Architecture in Golang

Published
Length
1 min read

Andrios Robert

All posts

Clean Architecture, by Robert C. Martin (Uncle Bob), is a design pattern for software. It focuses on separating concerns, testing, and maintaining code. But, using Clean Architecture in Golang applications has stirred debate. This is because Golang's philosophy differs from some aspects of Clean Architecture. The main controversies include: 1. Interface pollution: Clean Architecture uses many interfaces to separate layers. Golang prefers small, single-responsibility interfaces. Applying Clean

DPoP (Demonstration of Proof-of-Possession) + Zero Trust Architecture: the complete guide

Architecture patterns, implementation strategies, and security best practices. Delivered to your inbox.

Free white paper. No spam. Unsubscribe anytime.

Clean Architecture, by Robert C. Martin (Uncle Bob), is a design pattern for software. It focuses on separating concerns, testing, and maintaining code. But, using Clean Architecture in Golang applications has stirred debate. This is because Golang's philosophy differs from some aspects of Clean Architecture. The main controversies include:

  1. Interface pollution: Clean Architecture uses many interfaces to separate layers. Golang prefers small, single-responsibility interfaces. Applying Clean Architecture to Golang may create larger interfaces, breaking Golang's style.
  2. Package structure: Clean Architecture organizes code into layers. Golang favors simple package structures based on functionality. This creates a clash between Clean Architecture and Golang best practices.
  3. Dependency injection: Clean Architecture relies on dependency injection. Golang keeps things simple and lacks built-in dependency injection. Using dependency injection in Golang adds complexity and may need extra libraries.
  4. Testability: Clean Architecture aims to improve testability. Golang already supports testing well, with built-in tools and simplicity. Applying Clean Architecture to Golang might not improve testability but add complexity.


These controversies don't mean Clean Architecture won't work in Golang applications. Developers have used Clean Architecture successfully in Golang projects. But, it's crucial to adapt Clean Architecture principles to fit Golang's style and practices, instead of strictly following it.

Save the open-source gateway.

hoop is MIT-licensed infrastructure for controlling how AI agents reach production data. Star hoophq/hoop so you can inspect it, deploy it, or share it when your team starts governing agent access.