Clean architecture validator for go, like a The Dependency Rule and interaction between packages in your Go projects.
Switch branches/tags
Nothing to show
Clone or download
Robert Laszczak
Robert Laszczak bugfix
Latest commit 2047675 May 14, 2018
Type Name Latest commit message Commit time
Failed to load latest commit information.
cleanarch added -ignore-package flag May 14, 2018
docs fixed layers names Apr 14, 2017
examples added -ignore-package flag May 14, 2018
.gitignore added .gitignore Apr 12, 2017
LICENSE added license Jun 7, 2017
Makefile bugfix and better debug Feb 17, 2018 added -ignore-package flag May 14, 2018
flag.go bugfix May 14, 2018
main.go added -ignore-package flag May 14, 2018

Clean Architecture checker for Golang

Go Report Card

go-cleanarch was created to keep Clean Architecture rules, like a The Dependency Rule and interaction between modules in your Go projects. More about Clean Architecture you can read in Uncle's Bob article.

Some benefits of using Clean Architecture:

  1. Independent of Frameworks. The architecture does not depend on the existence of some library of feature laden software. This allows you to use such frameworks as tools, rather than having to cram your system into their limited constraints.
  2. Testable. The business rules can be tested without the UI, Database, Web Server, or any other external element.
  3. Independent of UI. The UI can change easily, without changing the rest of the system. A Web UI could be replaced with a console UI, for example, without changing the business rules.
  4. Independent of Database. You can swap out Oracle or SQL Server, for Mongo, BigTable, CouchDB, or something else. Your business rules are not bound to the database.
  5. Independent of any external agency. In fact your business rules simply don’t know anything at all about the outside world.

Source: The Clean Architecture

Clean Architecture

Project schema requirements

go-cleanarch assumes this files structure:




For example

  • go/src/
    • auth
      • domain
      • application
      • interfaces
    • content
      • domain
        • submodule1
        • submodule2
        • etc.
      • application
      • interfaces
    • frontend
      • domain
      • application
      • interfaces


var LayersAliases = map[string]Layer{
    // Domain
    "domain":   LayerDomain,
    "entities": LayerDomain,

    // Application
    "app":         LayerApplication,
    "application": LayerApplication,
    "usecases":    LayerApplication,
    "usecase":     LayerApplication,
    "use_cases":   LayerApplication,

    // Interfaces
    "interfaces": LayerInterfaces,
    "interface":  LayerInterfaces,
    "adapters":   LayerInterfaces,
    "adapter":    LayerInterfaces,

    // Infrastructure
    "infrastructure": LayerInfrastructure,
    "infra":          LayerInfrastructure,

For examples please go to examples directory, with contains examples of valid and invalid architectures.

For more informations about Clean Architecture please read Uncle's Bob article


go get -u

go-cleanarch was only tested on Linux and also should work on OS X. Probably it doesn't work well on Windows.


To run in current directory:


To run in provided directory

go-cleanarch go/src/

Process will exit with code 1 if architecture is not valid, otherwise it will exit with 0.


If you need to ignore *_test.go files in go-cleanarch check you can pass -ignore-tests

go-cleanarch -ignore-tests

It is useful when you have memory implementation in infrastructure layer and you need to test application service which depends of it.


If for some reason you need to allow to make forbidden import, for example to

you can use


Running the tests

make test

And coding style tests

make qa


Please read for details on our code of conduct, and the process for submitting pull requests to us.


We use SemVer for versioning. For the versions available, see the tags on this repository.


Made without love by Robert Laszczak </3


This project is licensed under the MIT License.