forked from xoe-labs/coredns-ldap
-
Notifications
You must be signed in to change notification settings - Fork 0
/
justfile
42 lines (34 loc) · 1.48 KB
/
justfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# use with https://github.com/casey/just
# use pre-commit manual stage
pre-commit-manual := "pre-commit run --hook-stage manual"
# fix auto-fixable lint issues in staged files
fix:
{{ pre-commit-manual }} go-returns-write # fixes all Go lint issues
{{ pre-commit-manual }} prettier # fixes all Markdown (& other) lint issues
# lint issues in - or due - to staged files
lint:
{{ pre-commit-manual }} go-vet-mod-changed # first run go vet
{{ pre-commit-manual }} go-lint-changed # then run golint
{{ pre-commit-manual }} golangci-lint-mod-changed # last run golangci-lint
# lint all issues
lint-all:
{{ pre-commit-manual }} golangci-lint-repo-mod-all || true # runs golangci-lint
# run tests in - or due - to staged files
test:
{{ pre-commit-manual }} go-test-repo-mod-all || true # runs go test
# push skipping pre-push hooks
push:
git push --no-verify
# install/update code automation
install:
curl https://pre-commit.com/install-local.py | python3 -
pre-commit install-hooks
# are NOT (yet) automatically installed
# through https://github.com/tekwizely/pre-commit-golang
go get github.com/sqs/goreturns
go get github.com/go-lintpack/lintpack/...
go get github.com/go-critic/go-critic/...
curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh| sh -s -- -b $(go env GOPATH)/bin v1.27.0
# setup hooks for stage (optional)
setup stage="pre-push":
pre-commit install --hook-type {{ stage }} # uninstall: `pre-commit uninstall`