File tree Expand file tree Collapse file tree 2 files changed +37
-0
lines changed
Expand file tree Collapse file tree 2 files changed +37
-0
lines changed Original file line number Diff line number Diff line change 1+ - id : go-arch-lint-check
2+ name : Check Go repo architecture
3+ description : Check Go repo architecture using go-arch-lint
4+ entry : go-arch-lint check
5+ language : golang
6+ pass_filenames : false
7+
8+ - id : go-arch-lint-graph
9+ name : Generate graph for Go repo architecture
10+ description : Generate graph for Go repo architecture using go-arch-lint
11+ entry : go-arch-lint graph
12+ language : golang
13+ pass_filenames : false
Original file line number Diff line number Diff line change @@ -162,3 +162,27 @@ go-arch-lint graph
162162```
163163
164164See full [ graph documentation] ( docs/graph/README.md ) for details.
165+
166+ ### Pre-Commit
167+
168+ go-arch-lint can also be used as a pre-commit hook, acting before each commit is made.
169+ This is useful to always check that your new code still respects your repo architecture, and to always update your graph SVG.
170+
171+ 1 . Install pre-commit from [ https://pre-commit.com/#install ] ( https://pre-commit.com/#install )
172+ 2 . Create a ` .pre-commit-config.yaml ` file at the root of your repository with the following content:
173+
174+ ``` go
175+ repos:
176+ - repo: https:// github.com/fe3dback/go-arch-lint
177+ rev: master
178+ hooks:
179+ - id: go -arch-lint-check
180+ - id: go -arch-lint-graph
181+ args: [' --include-vendors=true' , ' --out=go-arch-lint-graph.svg' ]
182+ ```
183+
184+ 3 . If needed, add any flags you need in ` args ` .
185+ 4 . Auto-update the config to the latest repos' versions by executing ` pre-commit autoupdate `
186+ 5 . Install with ` pre-commit install `
187+ 6 . Now you're all set! Try a commit, and see the logs (passing or failing).
188+
You can’t perform that action at this time.
0 commit comments