Skip to content

Commit 79882f9

Browse files
committed
chore: sync common makefiles for go 1.26
ref: https://redhat.atlassian.net/browse/ACM-35531 Signed-off-by: Janelle Law <jalaw@redhat.com>
1 parent 5c92998 commit 79882f9

2 files changed

Lines changed: 137 additions & 210 deletions

File tree

build/common/Makefile.common.mk

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ CONTROLLER_GEN_VERSION := v0.19.0
77
# https://github.com/kubernetes-sigs/kustomize/releases/latest
88
KUSTOMIZE_VERSION := v5.7.1
99
# https://github.com/golangci/golangci-lint/releases/latest
10-
GOLANGCI_VERSION := v1.64.8
10+
GOLANGCI_VERSION := v2.12.2
1111
# https://github.com/mvdan/gofumpt/releases/latest
1212
GOFUMPT_VERSION := v0.9.1
1313
# https://github.com/daixiang0/gci/releases/latest
@@ -23,6 +23,8 @@ GOCOVMERGE_VERSION := v2.16.0
2323
ENVTEST_VERSION ?= $(shell go list -mod=readonly -m -f "{{ .Version }}" sigs.k8s.io/controller-runtime 2>/dev/null | awk -F'[v.]' '{printf "release-%d.%d", $$2, $$3}')
2424
# Parse the Kubernetes API version from go.mod (which is v0.Y.Z) and convert to the corresponding v1.Y.Z format
2525
ENVTEST_K8S_VERSION := $(shell go list -mod=readonly -m -f "{{ .Version }}" k8s.io/api 2>/dev/null | awk -F'[v.]' '{printf "1.%d", $$3}')
26+
# https://github.com/gotestyourself/gotestsum/releases/latest
27+
GOTESTSUM_VERSION := v1.13.0
2628

2729
LOCAL_BIN ?= $(error LOCAL_BIN is not set.)
2830
ifneq ($(findstring $(LOCAL_BIN), $(PATH)), $(LOCAL_BIN))
@@ -76,11 +78,11 @@ lint: lint-dependencies lint-yaml lint-go
7678

7779
.PHONY: lint-dependencies
7880
lint-dependencies:
79-
$(call go-get-tool,github.com/golangci/golangci-lint/cmd/golangci-lint@$(GOLANGCI_VERSION))
81+
$(call go-get-tool,github.com/golangci/golangci-lint/v2/cmd/golangci-lint@$(GOLANGCI_VERSION))
8082

8183
.PHONY: lint-yaml
8284
lint-yaml:
83-
# Linting YAML
85+
# Linting YAML
8486
@$(FINDFILES) \( -name '*.yml' -o -name '*.yaml' \) -print0 | $(XARGS) grep -L -e "{{" | $(CLEANXARGS) yamllint -c ./build/common/config/.yamllint.yml
8587

8688
.PHONY: lint-go
@@ -106,10 +108,16 @@ fmt: fmt-dependencies
106108
GOSEC = $(LOCAL_BIN)/gosec
107109
KUBEBUILDER = $(LOCAL_BIN)/kubebuilder
108110
ENVTEST = $(LOCAL_BIN)/setup-envtest
111+
GOTESTSUM = $(LOCAL_BIN)/gotestsum
112+
113+
GOTST_FMT := --format=pkgname-and-test-fails --format-icons=text
114+
ifeq ($(GITHUB_ACTIONS), true)
115+
GOTST_FMT := --format=github-actions
116+
endif
109117

110118
.PHONY: kubebuilder
111119
kubebuilder:
112-
@if [ "$$($(KUBEBUILDER) version 2>/dev/null | grep -o KubeBuilderVersion:\"[0-9]*\.[0-9]\.[0-9]*\")" != "KubeBuilderVersion:\"$(KBVERSION)\"" ]; then \
120+
@if [ "$$($(KUBEBUILDER) version 2>/dev/null | grep -o KubeBuilderVersion:\"[0-9]*\.[0-9]*\.[0-9]*\")" != "KubeBuilderVersion:\"$(KBVERSION)\"" ]; then \
113121
echo "Installing Kubebuilder"; \
114122
curl -L https://github.com/kubernetes-sigs/kubebuilder/releases/download/v$(KBVERSION)/kubebuilder_$(GOOS)_$(GOARCH) -o $(KUBEBUILDER); \
115123
chmod +x $(KUBEBUILDER); \
@@ -128,6 +136,10 @@ gosec:
128136
gosec-scan: gosec
129137
$(GOSEC) -fmt sonarqube -out gosec.json -stdout -exclude-dir=.go -exclude-dir=test $(GOSEC_ARGS) ./...
130138

139+
.PHONY: gotestsum
140+
gotestsum:
141+
$(call go-get-tool,gotest.tools/gotestsum@$(GOTESTSUM_VERSION))
142+
131143
############################################################
132144
# E2E Test
133145
############################################################

0 commit comments

Comments
 (0)