Skip to content

Commit

Permalink
Add pre-commit go hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
as51340 committed Aug 9, 2024
1 parent c948168 commit 80a614b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 96 deletions.
96 changes: 2 additions & 94 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
rev: v4.6.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
Expand All @@ -12,102 +12,10 @@ repos:
- id: detect-private-key

- repo: https://github.com/tekwizely/pre-commit-golang
rev: master
rev: v1.0.0-rc.1
hooks:
#
# Go Build
#
- id: go-build-mod
- id: go-build-pkg
- id: go-build-repo-mod
- id: go-build-repo-pkg
#
# Go Mod Tidy
#
- id: go-mod-tidy
- id: go-mod-tidy-repo
#
# Go Test
#
- id: go-test-mod
- id: go-test-pkg
- id: go-test-repo-mod
- id: go-test-repo-pkg
#
# Go Vet
#
- id: go-vet
- id: go-vet-mod
- id: go-vet-pkg
- id: go-vet-repo-mod
- id: go-vet-repo-pkg
#
# Revive
#
- id: go-revive
- id: go-revive-mod
- id: go-revive-repo-mod
#
# GoSec
#
- id: go-sec-mod
- id: go-sec-pkg
- id: go-sec-repo-mod
- id: go-sec-repo-pkg
#
# StaticCheck
#
- id: go-staticcheck-mod
- id: go-staticcheck-pkg
- id: go-staticcheck-repo-mod
- id: go-staticcheck-repo-pkg
#
# StructSlop
#
- id: go-structslop-mod
- id: go-structslop-pkg
- id: go-structslop-repo-mod
- id: go-structslop-repo-pkg
#
# Formatters
#
- id: go-fmt
- id: go-fmt-repo
- id: go-fumpt # replaces go-fmt
- id: go-fumpt-repo # replaces go-fmt-repo
- id: go-imports # replaces go-fmt
- id: go-imports-repo # replaces go-fmt-repo
- id: go-returns # replaces go-imports & go-fmt
- id: go-returns-repo # replaces go-imports-repo & go-fmt-repo
#
# Style Checkers
#
- id: go-lint
- id: go-critic
#
# GolangCI-Lint
# - Fast Multi-Linter
# - Can be configured to replace MOST other hooks
# - Supports repo config file for configuration
# - https://github.com/golangci/golangci-lint
#
- id: golangci-lint
- id: golangci-lint-mod
- id: golangci-lint-pkg
- id: golangci-lint-repo-mod
- id: golangci-lint-repo-pkg
#
# Invoking Custom Go Tools
# - Configured *entirely* through the `args` attribute, ie:
# args: [ go, test, ./... ]
# - Use arg `--hook:error-on-output` to indicate that any output from the tool
# should be treated as an error.
# - Use the `name` attribute to provide better messaging when the hook runs
# - Use the `alias` attribute to be able to invoke your hook via `pre-commit run`
#
- id: my-cmd
- id: my-cmd-mod
- id: my-cmd-pkg
- id: my-cmd-repo
- id: my-cmd-repo-mod
- id: my-cmd-repo-pkg
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@ go 1.22.0
toolchain go1.22.5

require (
github.com/go-logr/logr v1.4.2
github.com/onsi/ginkgo/v2 v2.19.0
github.com/onsi/gomega v1.33.1
k8s.io/api v0.30.3
k8s.io/apimachinery v0.30.3
k8s.io/client-go v0.30.3
sigs.k8s.io/controller-runtime v0.18.4
Expand All @@ -19,7 +21,6 @@ require (
github.com/emicklei/go-restful/v3 v3.12.1 // indirect
github.com/evanphx/json-patch/v5 v5.9.0 // indirect
github.com/fsnotify/fsnotify v1.7.0 // indirect
github.com/go-logr/logr v1.4.2 // indirect
github.com/go-logr/zapr v1.3.0 // indirect
github.com/go-openapi/jsonpointer v0.21.0 // indirect
github.com/go-openapi/jsonreference v0.21.0 // indirect
Expand Down Expand Up @@ -61,7 +62,6 @@ require (
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
k8s.io/api v0.30.3 // indirect
k8s.io/apiextensions-apiserver v0.30.3 // indirect
k8s.io/klog/v2 v2.130.1 // indirect
k8s.io/kube-openapi v0.0.0-20240709000822-3c01b740850f // indirect
Expand Down

0 comments on commit 80a614b

Please sign in to comment.