Skip to content

Commit 6503734

Browse files
authored
Merge pull request #3642 from redhatrises/golanglint_ver
✨ (go/v4) allow golangci-lint version into the Makefile to be customizable
2 parents 274de81 + 71e2a64 commit 6503734

File tree

12 files changed

+25
-16
lines changed

12 files changed

+25
-16
lines changed

docs/book/src/component-config-tutorial/testdata/project/Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,11 @@ test: manifests generate fmt vet envtest ## Run tests.
6565
KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) --bin-dir $(LOCALBIN) -p path)" go test ./... -coverprofile cover.out
6666

6767
GOLANGCI_LINT = $(shell pwd)/bin/golangci-lint
68+
GOLANGCI_LINT_VERSION ?= v1.54.2
6869
golangci-lint:
6970
@[ -f $(GOLANGCI_LINT) ] || { \
7071
set -e ;\
71-
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(shell dirname $(GOLANGCI_LINT)) v1.54.2 ;\
72+
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(shell dirname $(GOLANGCI_LINT)) $(GOLANGCI_LINT_VERSION) ;\
7273
}
7374

7475
.PHONY: lint

docs/book/src/cronjob-tutorial/testdata/project/Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,11 @@ test: manifests generate fmt vet envtest ## Run tests.
6565
KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) --bin-dir $(LOCALBIN) -p path)" go test ./... -coverprofile cover.out
6666

6767
GOLANGCI_LINT = $(shell pwd)/bin/golangci-lint
68+
GOLANGCI_LINT_VERSION ?= v1.54.2
6869
golangci-lint:
6970
@[ -f $(GOLANGCI_LINT) ] || { \
7071
set -e ;\
71-
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(shell dirname $(GOLANGCI_LINT)) v1.54.2 ;\
72+
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(shell dirname $(GOLANGCI_LINT)) $(GOLANGCI_LINT_VERSION) ;\
7273
}
7374

7475
.PHONY: lint

pkg/plugins/common/kustomize/v2/scaffolds/webhook.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ package scaffolds
1818

1919
import (
2020
"fmt"
21+
2122
pluginutil "sigs.k8s.io/kubebuilder/v3/pkg/plugin/util"
2223

2324
log "github.com/sirupsen/logrus"

pkg/plugins/golang/v4/scaffolds/internal/templates/makefile.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,10 +129,11 @@ test: manifests generate fmt vet envtest ## Run tests.
129129
KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) --bin-dir $(LOCALBIN) -p path)" go test ./... -coverprofile cover.out
130130
131131
GOLANGCI_LINT = $(shell pwd)/bin/golangci-lint
132+
GOLANGCI_LINT_VERSION ?= v1.54.2
132133
golangci-lint:
133134
@[ -f $(GOLANGCI_LINT) ] || { \
134135
set -e ;\
135-
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(shell dirname $(GOLANGCI_LINT)) v1.54.2 ;\
136+
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(shell dirname $(GOLANGCI_LINT)) $(GOLANGCI_LINT_VERSION) ;\
136137
}
137138
138139
.PHONY: lint

testdata/project-v4-multigroup-with-deploy-image/Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,11 @@ test: manifests generate fmt vet envtest ## Run tests.
6565
KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) --bin-dir $(LOCALBIN) -p path)" go test ./... -coverprofile cover.out
6666

6767
GOLANGCI_LINT = $(shell pwd)/bin/golangci-lint
68+
GOLANGCI_LINT_VERSION ?= v1.54.2
6869
golangci-lint:
6970
@[ -f $(GOLANGCI_LINT) ] || { \
7071
set -e ;\
71-
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(shell dirname $(GOLANGCI_LINT)) v1.54.2 ;\
72+
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(shell dirname $(GOLANGCI_LINT)) $(GOLANGCI_LINT_VERSION) ;\
7273
}
7374

7475
.PHONY: lint

testdata/project-v4-multigroup-with-deploy-image/config/crd/kustomization.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@ resources:
1717
patches:
1818
# [WEBHOOK] To enable webhook, uncomment all the sections with [WEBHOOK] prefix.
1919
# patches here are for enabling the conversion webhook for each CRD
20-
#- path: patches/webhook_in_crew_captains.yaml
21-
#- path: patches/webhook_in_ship_frigates.yaml
22-
#- path: patches/webhook_in_ship_destroyers.yaml
23-
#- path: patches/webhook_in_ship_cruisers.yaml
24-
#- path: patches/webhook_in_sea-creatures_krakens.yaml
20+
- path: patches/webhook_in_crew_captains.yaml
21+
- path: patches/webhook_in_ship_frigates.yaml
22+
- path: patches/webhook_in_ship_destroyers.yaml
23+
- path: patches/webhook_in_ship_cruisers.yaml
24+
- path: patches/webhook_in_sea-creatures_krakens.yaml
2525
#- path: patches/webhook_in_sea-creatures_leviathans.yaml
2626
#- path: patches/webhook_in_foo.policy_healthcheckpolicies.yaml
2727
#- path: patches/webhook_in_foo_bars.yaml

testdata/project-v4-multigroup-with-deploy-image/config/default/kustomization.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ resources:
2020
- ../manager
2121
# [WEBHOOK] To enable webhook, uncomment all the sections with [WEBHOOK] prefix including the one in
2222
# crd/kustomization.yaml
23-
#- ../webhook
23+
- ../webhook
2424
# [CERTMANAGER] To enable cert-manager, uncomment all sections with 'CERTMANAGER'. 'WEBHOOK' components are required.
2525
#- ../certmanager
2626
# [PROMETHEUS] To enable prometheus monitor, uncomment all sections with 'PROMETHEUS'.
@@ -34,7 +34,7 @@ patchesStrategicMerge:
3434

3535
# [WEBHOOK] To enable webhook, uncomment all the sections with [WEBHOOK] prefix including the one in
3636
# crd/kustomization.yaml
37-
#- manager_webhook_patch.yaml
37+
- manager_webhook_patch.yaml
3838

3939
# [CERTMANAGER] To enable cert-manager, uncomment all sections with 'CERTMANAGER'.
4040
# Uncomment 'CERTMANAGER' sections in crd/kustomization.yaml to enable the CA injection in the admission webhooks.

testdata/project-v4-multigroup/Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,11 @@ test: manifests generate fmt vet envtest ## Run tests.
6565
KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) --bin-dir $(LOCALBIN) -p path)" go test ./... -coverprofile cover.out
6666

6767
GOLANGCI_LINT = $(shell pwd)/bin/golangci-lint
68+
GOLANGCI_LINT_VERSION ?= v1.54.2
6869
golangci-lint:
6970
@[ -f $(GOLANGCI_LINT) ] || { \
7071
set -e ;\
71-
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(shell dirname $(GOLANGCI_LINT)) v1.54.2 ;\
72+
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(shell dirname $(GOLANGCI_LINT)) $(GOLANGCI_LINT_VERSION) ;\
7273
}
7374

7475
.PHONY: lint

testdata/project-v4-multigroup/config/crd/kustomization.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ patches:
2222
- path: patches/webhook_in_ship_destroyers.yaml
2323
- path: patches/webhook_in_ship_cruisers.yaml
2424
- path: patches/webhook_in_sea-creatures_krakens.yaml
25-
- path: patches/webhook_in_sea-creatures_leviathans.yaml
25+
#- path: patches/webhook_in_sea-creatures_leviathans.yaml
2626
#- path: patches/webhook_in_foo.policy_healthcheckpolicies.yaml
2727
#- path: patches/webhook_in_foo_bars.yaml
2828
#- path: patches/webhook_in_fiz_bars.yaml

testdata/project-v4-with-deploy-image/Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,11 @@ test: manifests generate fmt vet envtest ## Run tests.
6565
KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) --bin-dir $(LOCALBIN) -p path)" go test ./... -coverprofile cover.out
6666

6767
GOLANGCI_LINT = $(shell pwd)/bin/golangci-lint
68+
GOLANGCI_LINT_VERSION ?= v1.54.2
6869
golangci-lint:
6970
@[ -f $(GOLANGCI_LINT) ] || { \
7071
set -e ;\
71-
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(shell dirname $(GOLANGCI_LINT)) v1.54.2 ;\
72+
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(shell dirname $(GOLANGCI_LINT)) $(GOLANGCI_LINT_VERSION) ;\
7273
}
7374

7475
.PHONY: lint

0 commit comments

Comments
 (0)