clean-layer-lint

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

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

Go to latest
Published: Apr 13, 2020 License: MIT Imports: 4 Imported by: 0

README

clean-layer-lint

test

 _____ _                __                       __    _     _   
|     | |___ ___ ___   |  |   ___ _ _ ___ ___   |  |  |_|___| |_ 
|   --| | -_| .'|   |  |  |__| .'| | | -_|  _|  |  |__| |   |  _|
|_____|_|___|__,|_|_|  |_____|__,|_  |___|_|    |_____|_|_|_|_|  
                                 |___|                           
                                                          

Clean architecture validator for go, like a The Dependency Rule and interaction between packages in your Go projects. Checks illegal imported layer. layer order depend on clean-layer.json setteing.

image

TODO

  • example
  • Specify files to ignore

Install

$ go get -u github.com/tkc/clean-layer-lint

Prepare clean-layer.json

{
   "path": "github.com/tkc/clean-layer-lint/src",
   "order":[
       "domain",
       "usecase",
       "interfaces",
       "infrastructure"
    ],
    "ignore":[]
 }

note:json format

key description
path go.mod module name + your layer directory path
order your layer order
ignore your ignore layer

Run

$ clean-layer-lint ./...

GitHub Actions Setting

lint.yml

on: [push, pull_request]
name: lint clean architecture
jobs:
  test:
    strategy:
      matrix:
        go-version: [1.13.x]
        platform: [ubuntu-latest, macos-latest, windows-latest]
    runs-on: ${{ matrix.platform }}
    steps:
    - name: Install Go
      if: success()
      uses: actions/setup-go@v1
      with:
        go-version: ${{ matrix.go-version }}
    - name: Setup env
      run: |
        echo "::set-env name=GOPATH::$(go env GOPATH)"
        echo "::set-env name=GOBIN::$(go env GOPATH)/bin"
        echo "::add-path::$(go env GOPATH)/bin"
    - name: install
      run: go get -u github.com/tkc/clean-layer-lint   
    - name: Checkout code
      uses: actions/checkout@v1
    - name: lint clean architecture
      run: clean-layer-lint ./...

License

MIT ✨

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
src

Jump to

Keyboard shortcuts

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