gocal

command module
v0.0.0-...-cfcf4d5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 24, 2023 License: MIT Imports: 8 Imported by: 0

README

gocal

The Go Clean Architecture Linter checks whether your go imports are following the dependency rule.

Find out more about the Clean Architecture and its dependency rule in this blog post.

Installation

Install simply via the Makefile:

make install

or with go get:

go get -u github.com/mheidinger/gocal

Usage

For gocal to work, your application needs to be split up in layers that are represented by different packages. These layer packages need to be listed from the inner to the outer layers in the .gocal file. Gocal will check for a layer not having imports of any outer layers. For example:

domain
application
adapter
plugin

With this configuration just run gocal in your project folder containing the .gocal and go.mod file. Without any ouput your project contains no violations. If there are any violations the output will look like the following:

~/Projects/gocal_test » gocal
domain/domain.go: Forbidden import of 'gocal_test/adapter'
domain/domain.go: Forbidden import of 'gocal_test/application'

If your gocal config file has a different name, use the name of the file as first argument:

~/Projects/gocal_test » gocal gocal.config

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL