From 059585f8c0493b1bee55bdbaf96ca9fce5124b74 Mon Sep 17 00:00:00 2001 From: Ben Perry Date: Wed, 18 Sep 2024 16:24:51 -0500 Subject: [PATCH] Switch to golanci-lint --- .github/workflows/ci.yaml | 10 ++++------ Makefile | 5 +---- README.md | 5 +++++ go.mod | 1 + go.sum | 4 ++++ 5 files changed, 15 insertions(+), 10 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 654bb48..d07d70b 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -20,12 +20,10 @@ jobs: uses: actions/setup-go@v5 with: go-version-file: 'go.mod' - - name: Install golint - run: go install golang.org/x/lint/golint - - name: Vet - run: make vet - - name: Linter - run: make lint + - name: golangci-lint + uses: golangci/golangci-lint-action@v6 + with: + version: v1.60 - name: Formatting run: make format-check test: diff --git a/Makefile b/Makefile index b22aa64..9134b43 100644 --- a/Makefile +++ b/Makefile @@ -11,11 +11,8 @@ KUBEBUILDER_VERSION=1.28.0 HELM_FILES := $(shell find deploy/httpreq-webhook) -vet: - @$(GO) vet ./... - lint: - @golint -set_exit_status ./... + @golangci-lint run ./... format: @gofmt -l -w ./ diff --git a/README.md b/README.md index 8a0a954..39c2944 100644 --- a/README.md +++ b/README.md @@ -16,3 +16,8 @@ Webhook is built off of the [Cert Manager Webhook Example](https://github.com/ce ```bash make test ``` + + +### Linters + +This repo uses golangci-lint. Follow the installation instructions [here](https://github.com/golangci/golangci-lint?tab=readme-ov-file#install-golangci-lint) diff --git a/go.mod b/go.mod index 810bc65..3b0de2d 100644 --- a/go.mod +++ b/go.mod @@ -9,6 +9,7 @@ require ( k8s.io/apiextensions-apiserver v0.30.2 k8s.io/apimachinery v0.30.2 k8s.io/client-go v0.30.2 + golang.org/x/lint v0.0.0-20210508222113-6edffad5e616 ) require ( diff --git a/go.sum b/go.sum index c02bd8c..abce428 100644 --- a/go.sum +++ b/go.sum @@ -205,6 +205,9 @@ golang.org/x/crypto v0.27.0 h1:GXm2NjJrPaiv/h1tb2UH8QfgC/hOf/+z0p6PT8o1w7A= golang.org/x/crypto v0.27.0/go.mod h1:1Xngt8kV6Dvbssa53Ziq6Eqn0HqbZi5Z6R0ZpwQzt70= golang.org/x/exp v0.0.0-20240506185415-9bf2ced13842 h1:vr/HnozRka3pE4EsMEg1lgkXJkTFJCVUX+S/ZT6wYzM= golang.org/x/exp v0.0.0-20240506185415-9bf2ced13842/go.mod h1:XtvwrStGgqGPLc4cjQfWqZHG1YFdYs6swckp8vpsjnc= +golang.org/x/lint v0.0.0-20210508222113-6edffad5e616 h1:VLliZ0d+/avPrXXH+OakdXhpJuEoBZuwh1m2j7U6Iug= +golang.org/x/lint v0.0.0-20210508222113-6edffad5e616/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= +golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.21.0 h1:vvrHzRwRfVKSiLrG+d4FMl/Qi4ukBCE6kZlTUkDYRT0= @@ -237,6 +240,7 @@ golang.org/x/time v0.5.0 h1:o7cqy6amK/52YcAKIPlM3a+Fpj35zvRj2TP+e1xFSfk= golang.org/x/time v0.5.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.25.0 h1:oFU9pkj/iJgs+0DT+VMHrx+oBKs/LJMV+Uvg78sl+fE=