Skip to content

Commit 3ea63fb

Browse files
authored
feat: add Go 1.26 support with golangci-lint v2.12.2 (#225)
Update both lint scripts to use golangci-lint v2.12.2 for Go 1.26+ projects. golangci-lint v2.12.2 is built with Go 1.26.2 and can lint Go 1.26 code. Previous versions (v2.8.0) were built with Go 1.25 and fail with: 'the Go language version used to build golangci-lint is lower than the targeted Go version' Version mapping: - Go 1.26+ -> golangci-lint v2.12.2 - Go 1.24-1.25 -> golangci-lint v2.8.0 - Go 1.23 -> golangci-lint v2.3.1 Signed-off-by: Tesshu Flower <tflower@redhat.com>
1 parent 9dbb933 commit 3ea63fb

3 files changed

Lines changed: 11 additions & 3 deletions

File tree

ci/lint/README-golangci-lint.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,8 @@ The script reads the Go version from `go.mod` and selects the correct golangci-l
5555

5656
| Go Version | golangci-lint Version | Config File |
5757
|------------|----------------------|-------------|
58-
| Go 1.24+ | v2.8.0 | `golangci-v2.yml` |
58+
| Go 1.26+ | v2.12.2 | `golangci-v2.yml` |
59+
| Go 1.24-1.25 | v2.8.0 | `golangci-v2.yml` |
5960
| Go 1.23 | v2.3.1 | `golangci-v2.yml` |
6061

6162
---

ci/lint/install-golangci-lint.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ fi
3636
# Reference: https://github.com/golangci/golangci-lint/issues/5032
3737
#
3838
# Compatibility table (all projects require Go 1.23+):
39+
# Go 1.26+ -> golangci-lint v2.12.2 (built with Go 1.26.2)
3940
# Go 1.24+ -> golangci-lint v2.8.0
4041
# Go 1.23 -> golangci-lint v2.3.1 (last v2 supporting Go 1.23)
4142
###############################################################################
@@ -79,7 +80,10 @@ select_compatible_version() {
7980

8081
# Select compatible version based on Go version
8182
# All projects require Go 1.23+
82-
if [[ "${go_ver_num}" -ge 124 ]]; then
83+
if [[ "${go_ver_num}" -ge 126 ]]; then
84+
# v2.12.2 is built with Go 1.26.2 and supports Go 1.26+
85+
echo "v2.12.2"
86+
elif [[ "${go_ver_num}" -ge 124 ]]; then
8387
echo "v2.8.0"
8488
elif [[ "${go_ver_num}" -ge 123 ]]; then
8589
# v2.3.1 is the last v2 release supporting Go 1.23

ci/lint/run-lint.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,11 @@ detect_versions() {
4848

4949
# Determine golangci-lint version based on Go version
5050
# All projects require Go 1.23+, always use golangci-lint v2
51+
# v2.12.2+ built with Go 1.26.2, supports Go 1.26+
5152
# v2.4.0+ requires Go 1.24+, v2.3.1 is the last v2 supporting Go 1.23
52-
if (( major == 1 && minor >= 24 )) || (( major > 1 )); then
53+
if (( major == 1 && minor >= 26 )) || (( major > 1 )); then
54+
LINT_VERSION="v2.12.2"
55+
elif (( major == 1 && minor >= 24 )); then
5356
LINT_VERSION="v2.8.0"
5457
elif (( major == 1 && minor == 23 )); then
5558
LINT_VERSION="v2.3.1"

0 commit comments

Comments
 (0)