Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(golangci-lint): v1.54.2 pinning and config file #256

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,9 @@ jobs:
go-version-file: go.mod
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with: # TODO: remove this when the deprecated function will be removed (issue #85)
args: --exclude SA1019 --timeout=5m -E ginkgolinter
with:
args: --timeout=5m -v
version: v1.54.2

check-gen:
runs-on: ubuntu-latest
Expand Down
22 changes: 22 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
linters-settings:
ginkgolinter:
forbid-focus-container: true

linters:
enable:
prometherion marked this conversation as resolved.
Show resolved Hide resolved
- deadcode
- errcheck
- ginkgolinter
- gosimple
- govet
- ineffassign
- staticcheck
- structcheck
- typecheck
- unused
- varcheck
disable: []

prometherion marked this conversation as resolved.
Show resolved Hide resolved
issues:
exclude:
- SA1019 # todo remove the exclude parameter when issue #85 is resolved
22 changes: 17 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
## --------------------------------------
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Loading