Skip to content

Commit 6df288c

Browse files
authored
Merge pull request #5 from mgrzybek/tools
[tools] add gitignore, pre-commit and makefile
2 parents 4ca8064 + cca33f4 commit 6df288c

File tree

3 files changed

+109
-0
lines changed

3 files changed

+109
-0
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
*.exe
2+
main
3+
onyxiactl

.pre-commit-config.yaml

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
repos:
2+
- repo: https://github.com/pre-commit/pre-commit-hooks
3+
rev: v4.0.1
4+
hooks:
5+
- id: end-of-file-fixer
6+
- id: trailing-whitespace
7+
8+
- repo: https://github.com/macisamuele/language-formatters-pre-commit-hooks
9+
rev: v1.5.0
10+
hooks:
11+
- id: pretty-format-yaml
12+
args: [--autofix, --indent, '2']
13+
14+
- repo: https://github.com/tekwizely/pre-commit-golang
15+
rev: v0.8.3
16+
hooks:
17+
#
18+
# Go Build
19+
#
20+
#- id: go-build-mod
21+
#- id: go-build-pkg
22+
#- id: go-build-repo-mod
23+
#- id: go-build-repo-pkg
24+
#
25+
# Go Test
26+
#
27+
- id: go-test-mod
28+
#- id: go-test-pkg
29+
- id: go-test-repo-mod
30+
#- id: go-test-repo-pkg
31+
#
32+
# Go Vet
33+
#
34+
#- id: go-vet
35+
- id: go-vet-mod
36+
#- id: go-vet-pkg
37+
- id: go-vet-repo-mod
38+
#- id: go-vet-repo-pkg
39+
#
40+
# Revive
41+
#
42+
#- id: go-revive
43+
#- id: go-revive-mod
44+
#- id: go-revive-repo-mod
45+
#
46+
# GoSec
47+
#
48+
#- id: go-sec-mod
49+
#- id: go-sec-pkg
50+
#- id: go-sec-repo-mod
51+
#- id: go-sec-repo-pkg
52+
#
53+
# Formatters
54+
#
55+
- id: go-fmt
56+
#- id: go-imports # Replaces go-fmt
57+
#- id: go-returns # Replaces go-imports & go-fmt
58+
#
59+
# Style Checkers
60+
#
61+
- id: go-lint
62+
#- id: go-critic
63+
#
64+
# GolangCI-Lint
65+
# - Fast Multi-Linter
66+
# - Can be configured to replace MOST other hooks
67+
# - Supports repo config file for configuration
68+
# - https://github.com/golangci/golangci-lint
69+
#
70+
#- id: golangci-lint
71+
#- id: golangci-lint-mod
72+
#- id: golangci-lint-pkg
73+
#- id: golangci-lint-repo-mod
74+
#- id: golangci-lint-repo-pkg

Makefile

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
.PHONY: help # This help message
2+
help:
3+
@grep '^.PHONY: .* #' Makefile \
4+
| sed 's/\.PHONY: \(.*\) # \(.*\)/\1\t\2/' \
5+
| expand -t20 \
6+
| sort
7+
8+
.PHONY: dev-prepare # Install go tools and pre-commit hooks
9+
dev-prepare:
10+
go get github.com/securego/gosec/v2/cmd/gosec
11+
go get github.com/mgechev/revive
12+
go get golang.org/x/lint/golint
13+
#go get github.com/go-critic/go-critic/cmd/gocritic
14+
#go get github.com/akrennmair/go-imports
15+
#go get github.com/golangci/golangci-lint/cmd/golangci-lint
16+
17+
pre-commit install
18+
19+
.PHONY: pre-commit # Run pre-commit compliance tests
20+
pre-commit:
21+
pre-commit run --all-files
22+
23+
.PHONY: test # Run go test
24+
test:
25+
go test
26+
27+
onyxiactl: test
28+
go build -o onyxyactl main.go
29+
30+
.PHONY: all # lint, test and build
31+
all: onyxiactl
32+
@echo

0 commit comments

Comments
 (0)