ddd

module
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jan 4, 2023 License: MIT

README

ddd Linter

The Go linter ddd checks that Domain Driven Design layers are applied properly. Main purpose is to avoid muddy code and to make it easier to keep the code clean and separated. For example, a file in the domain package must not directly import a file from any of the other layers.

You may read up on DDD code separation. Generally, as a rule of thumb, when the linter complains you may want to put and interface in the domain package and put an implementation it in the package you got the complaint from.

** NOTE: the compiler will complain about the imports in testdata packages. This necessary to make the tests pass and hence accepted. DO NOT FIX!

Install

To install directly from the repository, run:

go install gitlab.com/doertydoerk/ddd/cmd@latest

Run

ddd ./...

To skip all *_test.go file do:

ddd -test=false ./...

Release

To release a new version, run:

VERSION=[release] make release

Configuration

These are the default rules which are applied when no config file is provided.

Package Can import from
domain domain
application domain, application
infrastructure domain, infrasstructure
interfaces domain, interfaces, application

You can alter these rules by providing a config.ymlfile in the root of the project you want to run the linter on. The file should look like this:

layers:
  domain:
    - domain
  interfaces:
    - domain
    - interfaces
    - application
  application:
    - domain
    - application
  infrastructure:
    - domain
    - infrastructure

Miscellaneous

This linter is inspired and based on the following tutorials:

Directories

Path Synopsis
pkg

Jump to

Keyboard shortcuts

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