Cleanlinter — my first golang linter

I’ve implemented my first go linter, called cleanlinterhttps://github.com/bullgare/cleanlinter.

It’s a simplistic linter to check golang project internal imports according to Clean Architecture pattern.

Installation

go install github.com/bullgare/cleanlinter/cmd/cleanlinter@latest

Usage

cleanlinter \
-cleanlinter_path_to_domain=github.com/bullgare/cleanlinter/test/testdata/src/project_correct/internal/domain \
-cleanlinter_path_to_usecase=github.com/bullgare/cleanlinter/test/testdata/src/project_correct/internal/usecase \
-cleanlinter_path_to_adapter=github.com/bullgare/cleanlinter/test/testdata/src/project_correct/internal/adapter \
-cleanlinter_path_to_infra=github.com/bullgare/cleanlinter/test/testdata/src/project_correct/internal/infra \
./...

To be honest, writing proper integration tests made much more time than just writing the linter.

Articles, discussions, examples that helped me:
https://developer20.com/custom-go-linter/
https://stackoverflow.com/questions/72933175/go-get-filepath-from-ast-file
https://github.com/bkielbasa/cyclop/blob/master/pkg/analyzer/analyzer.go
https://github.com/alingse/asasalint/blob/main/asasalint_test.go

LEAVE A COMMENT