Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/roblaszczak/go-cleanarch
Clean architecture validator for go, like a The Dependency Rule and interaction between packages in your Go projects.
https://github.com/roblaszczak/go-cleanarch
architecture clean-architecture go golang uncle-bob
Last synced: about 1 month ago
JSON representation
Clean architecture validator for go, like a The Dependency Rule and interaction between packages in your Go projects.
- Host: GitHub
- URL: https://github.com/roblaszczak/go-cleanarch
- Owner: roblaszczak
- License: mit
- Created: 2017-04-12T21:59:16.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2021-11-08T16:18:42.000Z (over 2 years ago)
- Last Synced: 2024-04-24T12:53:39.571Z (about 1 month ago)
- Topics: architecture, clean-architecture, go, golang, uncle-bob
- Language: Go
- Homepage:
- Size: 797 KB
- Stars: 823
- Watchers: 11
- Forks: 45
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Lists
- awesome-go - go-cleanarch - go-cleanarch was created to validate Clean Architecture rules, like a The Dependency Rule and interaction between packages in your Go projects. (Code Analysis / Routers)
- awesome-go - go-cleanarch - go-cleanarch was created to validate Clean Architecture rules, like a The Dependency Rule and interaction between packages in your Go projects. (Code Analysis / Routers)
- awesome-go-linters - go-cleanarch - go-cleanarch was created to validate Clean Architecture rules, like a The Dependency Rule and interaction between packages in your Go projects. (Linters / Style and Patterns Checking)
- awesome-go-extra - go-cleanarch - 04-12T21:59:16Z|2021-11-08T16:18:42Z| (Code Analysis / Routers)
- awesome-go-cn - go-cleanarch - cleanarch`用于检查代码是否符合简洁架构的相关法则,比如依赖法则以及你的Go语言项目中各个库的交互情况 (相关工具 / 代码分析)
- awesome-go-zh - go-cleanarch - cleanarch是为了验证Clean Architecture规则而创建的,比如依赖规则和Go项目中的包之间的交互. (代码分析 / 路由器)
- awesome-go - go-cleanarch - go-cleanarch was created to validate Clean Architecture rules, like a The Dependency Rule and interaction between packages in your Go projects. (Code Analysis / Routers)
- go-awesome - go-cleanarch - Go 整洁架构规则校验工具 (开源类库 / DDD 框架)
- awesome-go - go-cleanarch - go-cleanarch was created to validate Clean Architecture rules, like a The Dependency Rule and interaction between packages in your Go projects. (Code Analysis / Routers)
- awesome-go-projects - go-cleanarch - go-cleanarch was created to validate Clean Architecture rules, like a The Dependency Rule and interaction between packages in your Go projects. (Code Analysis / Routers)
- awesome-go - go-cleanarch - cleanarch was created to validate Clean Architecture rules, like a The Dependency Rule and interaction between packages in your Go projects. | - | - | - | (Code Analysis / Routers)
- awesome-stars - go-cleanarch
- awesome-go-with-framework - go-cleanarch - go-cleanarch was created to validate Clean Architecture rules, like a The Dependency Rule and interaction between packages in your Go projects. (Code Analysis / Routers)
- awesome-go - go-cleanarch - go-cleanarch was created to validate Clean Architecture rules, like a The Dependency Rule and interaction between packages in your Go projects. (Code Analysis / Routers)
- awesome-go - go-cleanarch - go-cleanarch was created to validate Clean Architecture rules, like a The Dependency Rule and interaction between packages in your Go projects. (Code Analysis / Routers)
- awesome-go-stars - go-cleanarch - go-cleanarch was created to validate Clean Architecture rules, like a The Dependency Rule and interaction between packages in your Go projects. (Code Analysis / Routers)
- awesome-go-cn - go-cleanarch - cleanarch 的创建是为了验证 Clean 体系结构规则,比如 Go 项目中的依赖关系。 [![godoc][D]](https://godoc.org/github.com/roblaszczak/go-cleanarch) (代码分析 / 路由器)
- awesome-go - go-cleanarch - go-cleanarch was created to validate Clean Architecture rules, like a The Dependency Rule and interaction between packages in your Go projects. (Code Analysis / Routers)
- awesome-Char - go-cleanarch - go-cleanarch was created to validate Clean Architecture rules, like a The Dependency Rule and interaction between packages in your Go projects. (Code Analysis / Routers)
- awesome-go. - go-cleanarch - go-cleanarch was created to validate Clean Architecture rules, like a The Dependency Rule and interaction between packages in your Go projects. (Code Analysis / Routers)
- awesome-go - go-cleanarch - go-cleanarch was created to validate Clean Architecture rules, like a The Dependency Rule and interaction between packages in your Go projects. (Code Analysis / Routers)
- awesome-go-with-stars - go-cleanarch - go-cleanarch was created to validate Clean Architecture rules, like a The Dependency Rule and interaction between packages in your Go projects. (Code Analysis / Routers)
- awesome-go - go-cleanarch - go-cleanarch was created to validate Clean Architecture rules, like a The Dependency Rule and interaction between packages in your Go projects. (Code Analysis / Routers)
- repo-1316-awesome-go-cn - go-cleanarch - cleanarch 的创建是为了验证 Clean 体系结构规则,比如 Go 项目中的依赖关系。 [![godoc][D]](https://godoc.org/github.com/roblaszczak/go-cleanarch) (代码分析 / 路由器)
- repo-1211-awesome-go-cn - go-cleanarch - cleanarch 的创建是为了验证 Clean 体系结构规则,比如 Go 项目中的依赖关系。 [![godoc][D]](https://godoc.org/github.com/roblaszczak/go-cleanarch) (代码分析 / 路由器)
- awesome-go-zh - go-cleanarch - cleanarch 的创建是为了验证 Clean 体系结构规则,比如 Go 项目中的依赖关系。 [![godoc][D]](https://godoc.org/github.com/roblaszczak/go-cleanarch) (代码分析 / 路由器)
- awesome-reader - go-cleanarch - go-cleanarch was created to validate Clean Architecture rules, like a The Dependency Rule and interaction between packages in your Go projects. (Code Analysis / Routers)
- awesome-go - go-cleanarch - go-cleanarch was created to validate Clean Architecture rules, like a The Dependency Rule and interaction between packages in your Go projects. (Code Analysis / Routers)
- Go-awesome - go-cleanarch - go-cleanarch was created to validate Clean Architecture rules, like a The Dependency Rule and interaction between packages in your Go projects. (Code Analysis / Routers)
- awesome-go - go-cleanarch - go-cleanarch was created to validate Clean Architecture rules, like a The Dependency Rule and interaction between packages in your Go projects. (Code Analysis / Routers)
- awesome-go - go-cleanarch - go-cleanarch was created to validate Clean Architecture rules, like a The Dependency Rule and interaction between packages in your Go projects. (Code Analysis / Routers)
- awesome-go-cn - go-cleanarch - cleanarch 的创建是为了验证 Clean 体系结构规则,比如 Go 项目中的依赖关系。 [![godoc][D]](https://godoc.org/github.com/roblaszczak/go-cleanarch) (代码分析 / 路由器)
- awesome-go-handwritten - go-cleanarch - go-cleanarch was created to validate Clean Architecture rules, like a The Dependency Rule and interaction between packages in your Go projects. (Code Analysis / Routers)
- awesome-go - go-cleanarch - go-cleanarch was created to validate Clean Architecture rules, like a The Dependency Rule and interaction between packages in your Go projects. - :arrow_down:0 - :star:210 (Code Analysis / Routers)
- go-awesome - go-cleanarch - Verification tool for clean architecture rules (Open source library / DDD Framework)
- awesome-go2 - go-cleanarch - go-cleanarch was created to validate Clean Architecture rules, like a The Dependency Rule and interaction between packages in your Go projects. (Code Analysis / Routers)
- awesome-go - go-cleanarch - go-cleanarch was created to validate Clean Architecture rules, like a The Dependency Rule and interaction between packages in your Go projects. (Code Analysis / Routers)
- awesome-go - go-cleanarch - go-cleanarch was created to validate Clean Architecture rules, like a The Dependency Rule and interaction between packages in your Go projects. (Code Analysis / Routers)
- awesome-go - go-cleanarch - go-cleanarch was created to validate Clean Architecture rules, like a The Dependency Rule and interaction between packages in your Go projects. (Code Analysis / Routers)
- awesome-go-cn - go-cleanarch - cleanarch 的创建是为了验证 Clean 体系结构规则,比如 Go 项目中的依赖关系。 ![star > 100][Bronze] ![最近一年没有更新][Yellow] (代码分析 / 路由器)
- awesome-go - go-cleanarch - go-cleanarch was created to validate Clean Architecture rules, like a The Dependency Rule and interaction between packages in your Go projects. (Code Analysis / Routers)
- awesome-go - go-cleanarch - go-cleanarch was created to validate Clean Architecture rules, like a The Dependency Rule and interaction between packages in your Go projects. (Code Analysis / Routers)
- awesome-go-cn - go-cleanarch - cleanarch被创建来验证清洁架构规则,比如Go项目中的依赖规则和包之间的交互。 (go-cleanarch was created to validate Clean Architecture rules, like a The Dependency Rule and interaction between packages in your Go projects.) (代码分析 / Routers)
- go-awesome-cn-star - go-cleanarch - cleanarch`用于检查代码是否符合简洁架构的相关法则,比如依赖法则以及你的Go语言项目中各个库的交互情况(564) (相关工具`go相关工具和插件` / 代码分析)
- awesome-go - go-cleanarch - Clean architecture validator for go, like a The Dependency Rule and interaction between packages in your Go projects. - ★ 223 (Code Analysis)
README
# Clean Architecture checker for Golang
[![Go Report Card](https://goreportcard.com/badge/github.com/roblaszczak/go-cleanarch)](https://goreportcard.com/report/github.com/roblaszczak/go-cleanarch)
go-cleanarch was created to keep Clean Architecture rules,
like a _The Dependency Rule_ and _interaction between modules_ in your Go projects.
For more information you should read [our article about Clean Architecture](https://threedots.tech/post/introducing-clean-architecture/?utm_source=go-cleanarch).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](docs/go-cleanarch.png)
### Project schema requirements
go-cleanarch assumes this files structure:
[GOPATH]/[PACKAGE_NAME]/[LAYER_NAME]
or
[GOPATH]/[PACKAGE_NAME]/[MODULE_NAME]/[LAYER_NAME]
For example
* go/src/github.com/roblaszczak/awesome-app
* auth
* domain
* application
* interfaces
* content
* domain
* submodule1
* submodule2
* *etc.*
* application
* interfaces
* frontend
* domain
* application
* interfaces### Allowed `LAYER_NAME`:
The default layer names are as followed. It is possible to set different names
by command line parameters see -domain/-application/-interfaces/-infrastructure
bellow.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](examples/) directory,
with contains examples of valid and invalid architectures.For more information you should read [our article about Clean Architecture](https://threedots.tech/post/introducing-clean-architecture/?utm_source=go-cleanarch).
## Installing
go install github.com/roblaszczak/go-cleanarch@latest
_go-cleanarch was only tested on Linux and also should work on OS X.
Probably it doesn't work well on Windows._## Running
To run in the current directory:
go-cleanarch
To run in provided directory
go-cleanarch go/src/github.com/roblaszczak/awesome-cms
Process will exit with code `1` if architecture is not valid, otherwise it will exit with `0`.
### -ignore-tests
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.### -ignore-package
If for some reason you need to allow to make forbidden import, for example
`github.com/roblaszczak/go-cleanarch/examples/ignore-package/app` to `github.com/roblaszczak/go-cleanarch/examples/ignore-package/domain`.
you can use
go-cleanarch -ignore-package=github.com/roblaszczak/go-cleanarch/examples/ignore-package/app
### Layer names
The layer names can be set to a specific value with the following parameters. Each
parameter stands for on layer.go-cleanarch -domain dom -application appli -interfaces int -infrastructure outer
This would only allow the domain name to be dom, application hast to be appli,
interafces must be int and infrastructure must be outer.## Running the tests
make test
## And coding style tests
make qa
## Contributing
Please read [CONTRIBUTING.md](https://gist.github.com/PurpleBooth/b24679402957c63ec426) for details on our code of conduct, and the process for submitting pull requests to us.
## Versioning
We use [SemVer](http://semver.org/) for versioning. For the versions available, see the [tags on this repository](https://github.com/your/project/tags).
## Credits
Made without love by Robert Laszczak 3
## License
This project is licensed under the MIT License.