Skip to content

Commit 42e9411

Browse files
authored
Merge pull request #398 from sir-gon/develop
AI driven dependency-issues fixed.
2 parents 71beebe + 5f1d563 commit 42e9411

File tree

16 files changed

+38
-28
lines changed

16 files changed

+38
-28
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

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ WORKDIR ${WORKDIR}
2929

3030
RUN apk add --update --no-cache make nodejs npm wget \
3131
&& apk add --update --no-cache yamllint \
32-
&& npm install -g --ignore-scripts markdownlint-cli
32+
&& npm install -g --ignore-scripts markdownlint-cli@0.47.0
3333

3434
ADD https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh ${WORKDIR}/
3535
RUN sh install.sh -b $(go env GOPATH)/bin v2.0.0 \

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/...

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,8 @@ You can run tests in the following ways:
7979
installed in your SO.
8080
- [Install and run with make](#install-and-run-using-make) require runtime tools
8181
and "make" installed in your SO.
82-
- [Install and run in Docker](#install-and-running-with-docker-) require Docker and
83-
docker-compose installed.
82+
- [Install and run in Docker](#install-and-running-with-docker-) require Docker
83+
and docker-compose installed.
8484
- (⭐️)
8585
[Install and in Docker with make](#install-and-running-with-docker--using-make)
8686
require docker-compose and make installed.

docs/hackerrank/interview_preparation_kit/dictionaries_and_hashmaps/ctci-ransom-note.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,8 @@ The third line contains `n` space-separated strings, each `node[i]`.
4949

5050
- $ 1 \leq m, n \leq 30000 $
5151
- $ 1 \leq $ length of `magazine[i]` and `note[i]` $ \leq 5 $
52-
- Each word consists of English alphabetic letters (i.e., `a` to `z` and `A` to `Z`).
52+
- Each word consists of English alphabetic letters (i.e., `a` to `z` and `A` to
53+
`Z`).
5354

5455
## Sample Input 0
5556

docs/hackerrank/interview_preparation_kit/greedy_algorithms/angry-children.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,4 +140,5 @@ max(1,2,3,4) - min(1,2,3,4) = 4 - 1 = 3
140140

141141
## Explanation 2
142142

143-
Here `k = 2`. `arr' = [2, 2]` or `arr' = [1, 1]` give the minimum unfairness of `0`.
143+
Here `k = 2`. `arr' = [2, 2]` or `arr' = [1, 1]` give the minimum unfairness
144+
of `0`.

docs/hackerrank/interview_preparation_kit/greedy_algorithms/greedy-florist.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,8 @@ the original price of each flower.
7474

7575
## Explanation 0
7676

77-
There are `n = 3` flowers with costs `c = [2, 5, ,6]` and `k = 3` people in the group.
77+
There are `n = 3` flowers with costs `c = [2, 5, ,6]` and `k = 3` people
78+
in the group.
7879
If each person buys one flower,
7980
the total cost of prices paid is `2 + 5 + 6 = 13` dollars.
8081
Thus, we print `13` as our answer.

docs/projecteuler/problem0002.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# [Even Fibonacci numbers](https://projecteuler.net/problem=2)
22

3-
Each new term in the Fibonacci sequence is generated by adding the previous two terms.
3+
Each new term in the Fibonacci sequence is generated by adding the previous
4+
two terms.
45
By starting with 1 and 2, the first 10 terms will be:
56

67
$ 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ... $

docs/projecteuler/problem0020.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
$ n! $ means $ n × (n − 1) × ... × 3 × 2 × 1 $
44

55
For example, $ 10! = 10 × 9 × ... × 3 × 2 × 1 = 3628800 $,
6-
and the sum of the digits in the number $ 10! is 3 + 6 + 2 + 8 + 8 + 0 + 0 = 27 $.
6+
and the sum of the digits in the number $ 10! $ is
7+
$ 3 + 6 + 2 + 8 + 8 + 0 + 0 = 27 $.
78

89
Find the sum of the digits in the number $ 100! $

0 commit comments

Comments
 (0)