go-cleanarch alternatives and similar packages
Based on the "Code Analysis" category.
Alternatively, view go-cleanarch alternatives based on common mentions on social networks and blogs.
-
Go Metalinter
Metalinter is a tool to automatically apply all static analysis tool and report their output in normalized form. -
go-mod-outdated
Find outdated dependencies of your Go projects. go-mod-outdated provides a table view of the go list -u -m -json all command which lists all dependencies of a Go project and their available minor and patch updates. It also provides a way to filter indirect dependencies and dependencies without updates. -
goreturns
A gofmt/goimports-like tool for Go programmers that fills in Go return statements with zero values to match the func return types -
tickgit
Manage your repository's TODOs, tickets and checklists as config in your codebase. -
GoCover.io
GoCover.io offers the code coverage of any golang package as a service. -
gostatus
A command line tool that shows the status of Go repositories. -
apicompat
apicompat checks recent changes to a Go project for backwards incompatible changes -
ChainJacking
Find which of your direct GitHub dependencies is susceptible to RepoJacking attacks -
go-outdated
Console application that displays outdated packages. -
usestdlibvars
A linter that detect the possibility to use variables/constants from the Go standard library. -
tarp
tarp finds functions and methods without direct unit tests in Go source code. -
staticcheck
staticcheck is go vet on steroids, applying a ton of static analysis checks you might be used to from tools like ReSharper for C#. -
gosimple
gosimple is a linter for Go source code that specialises on simplifying code. -
Golint online
Lints online Go source files on GitHub, Bitbucket and Google Project Hosting using the golint package. -
unused
unused checks Go code for unused constants, variables, functions and types. -
blanket
blanket is a tool that helps you catch functions which don't have direct unit tests in your Go packages.
Static code analysis for 29 languages.
Do you think we are missing an alternative of go-cleanarch or a related project?
README
Clean Architecture checker for Golang
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.
Some benefits of using Clean Architecture:
- 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.
- Testable. The business rules can be tested without the UI, Database, Web Server, or any other external element.
- 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.
- 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.
- 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
- domain
- frontend
- domain
- application
- interfaces
- auth
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.
Installing
GO111MODULE=on go get github.com/roblaszczak/go-cleanarch
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 for details on our code of conduct, and the process for submitting pull requests to us.
Versioning
We use SemVer for versioning. For the versions available, see the tags on this repository.
Credits
Made without love by Robert Laszczak </3
License
This project is licensed under the MIT License.
*Note that all licence references and agreements mentioned in the go-cleanarch README section above
are relevant to that project's source code only.