generated from kubernetes/kubernetes-template-project
-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #256 from prometherion/chore/declarative-golangci-…
…lint chore(golangci-lint): v1.54.2 pinning and config file
- Loading branch information
Showing
3 changed files
with
42 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
linters-settings: | ||
ginkgolinter: | ||
forbid-focus-container: true | ||
|
||
linters: | ||
enable: | ||
- deadcode | ||
- errcheck | ||
- ginkgolinter | ||
- gosimple | ||
- govet | ||
- ineffassign | ||
- staticcheck | ||
- structcheck | ||
- typecheck | ||
- unused | ||
- varcheck | ||
disable: [] | ||
|
||
issues: | ||
exclude: | ||
- SA1019 # todo remove the exclude parameter when issue #85 is resolved |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -69,6 +69,16 @@ all: test manager | |
help: ## Display this help | ||
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m<target>\033[0m\n"} /^[a-zA-Z_-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST) | ||
|
||
# go-install-tool will 'go install' any package $2 and install it to $1. | ||
PROJECT_DIR := $(shell dirname $(abspath $(lastword $(MAKEFILE_LIST)))) | ||
define go-install-tool | ||
@[ -f $(1) ] || { \ | ||
set -e ;\ | ||
echo "Installing $(2)" ;\ | ||
GOBIN=$(PROJECT_DIR)/bin go install $(2) ;\ | ||
} | ||
endef | ||
|
||
## -------------------------------------- | ||
## Testing | ||
## -------------------------------------- | ||
|
@@ -205,7 +215,7 @@ modules: ## Runs go mod to ensure modules are up to date. | |
.PHONY: docker-pull-prerequisites | ||
docker-pull-prerequisites: | ||
docker pull docker.io/docker/dockerfile:1.4 | ||
docker pull docker.io/library/golang:1.20 | ||
docker pull docker.io/library/golang:1.20.2 | ||
docker pull gcr.io/distroless/static:latest | ||
|
||
.PHONY: docker-build | ||
|
@@ -329,11 +339,13 @@ goimports: | |
go install golang.org/x/tools/cmd/goimports@latest | ||
goimports -w -local="sigs.k8s.io/cluster-api-provider-kubevirt" $(shell find . -type f -name '*.go' ! -path "*/vendor/*" ! -path "./_kubevirtci/*" ! -path "*zz_generated*" ) | ||
|
||
GOLANGCI_LINT = $(shell pwd)/bin/golangci-lint | ||
golangci-lint: ## Download golangci-lint locally if necessary. | ||
$(call go-install-tool,$(GOLANGCI_LINT),github.com/golangci/golangci-lint/cmd/[email protected]) | ||
|
||
.PHONY: linter | ||
linter: | ||
go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest | ||
# todo remove the exclude parameter when issue #85 is resolved | ||
golangci-lint run --timeout=5m -E ginkgolinter --exclude SA1019 | ||
linter: golangci-lint | ||
$(GOLANGCI_LINT) run --timeout=5m -v | ||
|
||
.PHONY: sanity | ||
sanity: linter goimports test |