Skip to content

Commit 55cd5e9

Browse files
author
Mathieu Grzybek
committed
[tools] add gitignore, pre-commit and makefile
1 parent 2498514 commit 55cd5e9

File tree

3 files changed

+95
-0
lines changed

3 files changed

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

Makefile

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
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: pre-commit # Run pre-commit compliance tests
9+
pre-commit:
10+
go get github.com/golangci/golangci-lint/cmd/[email protected]
11+
pre-commit install
12+
pre-commit run --all-files
13+
14+
.PHONY: test # Run go test
15+
test:
16+
go test
17+
18+
onyxiactl: test
19+
go build -o onyxyactl main.go
20+
21+
.PHONY: all # lint, test and build
22+
all: lint test onyxiactl
23+
@echo

0 commit comments

Comments
 (0)