Commit eeba084
committed
operator,storage-operator: pin Go toolchain to
Add explicit Go `1.22.12` toolchain enforcement and upgrade setup-envtest to fix CI lint and test failures.
**Problem:**
- After Go `1.26.0` release (Feb 10, 2026), Go's toolchain selection
algorithm started automatically choosing Go `1.25.7` instead of `1.22.x`.
- Go `1.25.7` is incompatible with `golang.org/x/tools v0.20.0`,
causing all CI lint/test jobs to fail with:
`invalid array length -delta * delta (constant -256 of type int64)`
Additionally, setup-envtest `release-0.18` had GCS access issues causing
unit tests to fail with "401 Unauthorized" when downloading
kubebuilder-tools.
This affects ALL branches based on development/131.0.
**Root cause:**
Go's algorithm prefers 'latest patch before most recent version'.
Before Feb 10: `[1.22.x, 1.25.7]` → chooses `1.22.x` (before `1.25`)
After Feb 10: `[1.22.x, 1.25.7, 1.26.0]` → chooses `1.25.7` (before `1.26`)
**Solution (3-part fix):**
1. Add `toolchain go1.22.12` directive in go.mod files
2. Export `GOTOOLCHAIN=go1.22.12` globally in Makefiles
3. Bump `ENVTEST_VERSION` from `release-0.18` to `release-0.19`
Using `go1.22.12` (latest patch of `1.22`) aligns with our go.mod
requirement (go `1.22.0`) and avoids the `x/tools v0.20.0` bug.
Upgrading to setup-envtest release-0.19 fixes GCS access issues
and allows unit tests to download kubebuilder-tools successfully.
**Files modified:**
- `operator/go.mod` and `storage-operator/go.mod`: Added `toolchain` directive
- `operator/Makefile`: Added `export GOTOOLCHAIN` + bumped `ENVTEST_VERSION`
- `storage-operator/go.mod`: Added `toolchain` directive
- `storage-operator/Makefile`: Added `export GOTOOLCHAIN` + bumped `ENVTEST_VERSION`
This is a minimal fix to unblock CI. A proper Go `1.26` bump will be
done in a separate ticket with full dependency updates.
**References:**
- Go toolchain selection: https://go.dev/doc/toolchain
- Algorithm source: https://go.dev/src/cmd/go/internal/toolchain/switch.go
- Bug in x/tools v0.20.0: tokeninternal.go:64
Fixes: MK8S-1311.22.12 and bump envtest to release-0.19
1 parent 327422a commit eeba084
4 files changed
+12
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
55 | 55 | | |
56 | 56 | | |
57 | 57 | | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
58 | 62 | | |
59 | 63 | | |
60 | 64 | | |
| |||
211 | 215 | | |
212 | 216 | | |
213 | 217 | | |
214 | | - | |
| 218 | + | |
215 | 219 | | |
216 | 220 | | |
217 | 221 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
| 4 | + | |
4 | 5 | | |
5 | 6 | | |
6 | 7 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
55 | 55 | | |
56 | 56 | | |
57 | 57 | | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
58 | 62 | | |
59 | 63 | | |
60 | 64 | | |
| |||
211 | 215 | | |
212 | 216 | | |
213 | 217 | | |
214 | | - | |
| 218 | + | |
215 | 219 | | |
216 | 220 | | |
217 | 221 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
| 4 | + | |
4 | 5 | | |
5 | 6 | | |
6 | 7 | | |
| |||
0 commit comments