Skip to content

Commit 56a3be1

Browse files
author
Gonzalo Diaz
committed
AI driven dependency-issues fixed.
1 parent 71beebe commit 56a3be1

File tree

3 files changed

+22
-12
lines changed

3 files changed

+22
-12
lines changed

.github/workflows/go-lint.yml

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
fail-fast: false
2020
matrix:
2121
os: ["windows-2022", "ubuntu-24.04", "macos-14"]
22-
go: ["1.24.x", "1.25.x"]
22+
go: ["1.23.x", "1.24.x", "1.25.x"]
2323
runs-on: ${{ matrix.os }}
2424
steps:
2525
- uses: actions/checkout@v6
@@ -32,14 +32,8 @@ jobs:
3232

3333
- run: go version
3434

35-
- name: Test Styling (gofmt)
36-
run: gofmt -l . && echo '✔ Your code looks good.'
37-
38-
# yamllint disable rule:line-length
39-
- name: Test Styling (analysis/modernize) Analyzer modernize
40-
if: ${{ ! startsWith(matrix.go, '1.22') }}
41-
run: go run golang.org/x/tools/gopls/internal/analysis/modernize/cmd/modernize@latest -test ./...
42-
# yamllint enable rule:line-length
35+
- name: Test Styling (gofmt & modernize)
36+
run: make test/styling
4337

4438
- name: Lint (go vet)
4539
run: go vet -v ./...

.github/workflows/go-test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
fail-fast: false
2020
matrix:
2121
os: ["windows-2022", "ubuntu-24.04", "macos-14"]
22-
go: ["1.24.x", "1.25.x"]
22+
go: ["1.23.x", "1.24.x", "1.25.x"]
2323
runs-on: ${{ matrix.os }}
2424
steps:
2525
- uses: actions/checkout@v6

Makefile

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,22 @@ PKG_LIST=$(go list ./... | grep -v /vendor/ | tr '\n' ' '| xargs echo -n)
3939
BUILDKIT_PROGRESS=plain
4040
CGO_ENABLED=0
4141

42+
# Modernize tool versioning
43+
# Go 1.25 requires gopls v0.21.0+
44+
# Go 1.24 and below should use gopls v0.20.0
45+
GO_VERSION := $(shell go version | cut -d' ' -f3 | sed 's/go//')
46+
MODERNIZE_VER := v0.20.0
47+
48+
# Check if Go version is 1.25 or higher
49+
IS_GO_125 := $(shell echo "$(GO_VERSION)" | awk -F. '{if ($$1 > 1 || ($$1 == 1 && $$2 >= 25)) print 1; else print 0}')
50+
51+
ifeq ($(IS_GO_125),1)
52+
MODERNIZE_VER := latest
53+
endif
54+
55+
# Use GOTOOLCHAIN=auto to ensure the required toolchain is available if needed
56+
MODERNIZE_CMD := GOTOOLCHAIN=auto $(GO) run golang.org/x/tools/gopls/internal/analysis/modernize/cmd/modernize@$(MODERNIZE_VER)
57+
4258
.MAIN: test/coverage
4359
.PHONY: all clean coverage dependencies help list test
4460
.EXPORT_ALL_VARIABLES: # (2)
@@ -82,10 +98,10 @@ test/static: dependencies
8298

8399
test/styling: dependencies
84100
gofmt -l . && echo '✔ Your code looks good.'
85-
$(GO) run golang.org/x/tools/gopls/internal/analysis/modernize/cmd/modernize@latest -test ./...
101+
$(MODERNIZE_CMD) -test ./...
86102

87103
format:
88-
$(GO) run golang.org/x/tools/gopls/internal/analysis/modernize/cmd/modernize@latest -fix ./...
104+
$(MODERNIZE_CMD) -fix ./...
89105

90106
coverage.out: env dependencies
91107
$(GOTEST) -v -covermode=atomic -coverprofile="coverage.out" ./exercises/...

0 commit comments

Comments
 (0)