impas is an IMPort ASsertion tool. This command-line tool enables you to validate inter-packages dependencies within your golang project.
Most of practical projects consist of some kinds of layers, like UI, SERVICE, DAO, INFRA, ... etc. There are no problems if you develop the project by yourself because you should understand the whole project. On the other hand, team development may have some problems about understanding package dependency rules of the project. Especially, a new developer who doesn't know the whole project tends to write a code which breach the rule, because such rules are often implicit.
Now, impas makes it explict!
go get -u github.com/tomoemon/impas
First, prepare a dependency rule file like below
https://github.com/tomoemon/impas/blob/master/docs/sample_config_success.toml
Run following command
impas -config docs/sample_config_success.toml
If command fail, it returns exit status 1
impas -config docs/sample_config_error.toml