|
| 1 | +# GOTOOLCHAIN pins the Go toolchain for all build/generate/test targets. |
| 2 | +# The tooling module (tools/go.mod) requires Go >= 1.26, while the root module |
| 3 | +# keeps its language level at `go 1.24` so the pinned golangci-lint (built with |
| 4 | +# go1.24) still accepts go.mod. Forcing one toolchain here — rather than a |
| 5 | +# go.mod `toolchain` directive — avoids GOTOOLCHAIN=auto switching mid-build, |
| 6 | +# which breaks coverage ("go: no such tool covdata"). go1.26.5 is the first |
| 7 | +# release carrying the fixes for CVE-2026-39822 and CVE-2026-42505. |
| 8 | +export GOTOOLCHAIN ?= go1.26.5 |
| 9 | + |
1 | 10 | # VERSION defines the project version for the bundle. |
2 | 11 | # Update this value when you upgrade the version of your project. |
3 | 12 | # To re-generate a bundle for another specific version without changing the standard setup, you can: |
@@ -131,7 +140,11 @@ KIND_CLUSTER ?= hyperfleet-operator-test-e2e |
131 | 140 |
|
132 | 141 | .PHONY: test |
133 | 142 | test: manifests generate fmt vet ## Run tests. |
134 | | - KUBEBUILDER_ASSETS="$(shell $(SETUP_ENVTEST) use $(ENVTEST_K8S_VERSION) -p path)" go test $$(go list ./... | grep -v /e2e) -coverprofile cover.out |
| 143 | + # Resolve envtest assets in the recipe shell (via $$(...)) rather than make's |
| 144 | + # $(shell ...): the latter runs at parse time and does not inherit the |
| 145 | + # exported GOTOOLCHAIN, so setup-envtest (a tools/go.mod tool needing Go 1.26) |
| 146 | + # would run under the wrong toolchain and yield an empty KUBEBUILDER_ASSETS. |
| 147 | + KUBEBUILDER_ASSETS="$$($(SETUP_ENVTEST) use $(ENVTEST_K8S_VERSION) -p path)" go test $$(go list ./... | grep -v /e2e) -coverprofile cover.out |
135 | 148 |
|
136 | 149 | .PHONY: setup-test-e2e |
137 | 150 | setup-test-e2e: ## Set up a Kind cluster for e2e tests if it does not exist |
|
0 commit comments