Skip to content

Commit 1205762

Browse files
committed
chore: lint improvements
1 parent d7fd724 commit 1205762

File tree

7 files changed

+7
-26
lines changed

7 files changed

+7
-26
lines changed

go/2024/puzzles/day12/main.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,9 +109,7 @@ func findPlantBed(g grid.Grid, visited map[grid.Point]bool, start grid.Point) (m
109109
area[current] = true
110110
visited[current] = true
111111

112-
for _, neighbor := range neighbors {
113-
queue = append(queue, neighbor)
114-
}
112+
queue = append(queue, neighbors...)
115113
}
116114

117115
return area, perimeter

go/2024/puzzles/day15/main.go

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,7 @@ func part1(name string) int {
3636
if warehouse.Get(next) == 'O' {
3737
tmp := next.Add(m)
3838

39-
for {
40-
if warehouse.Get(tmp) != 'O' {
41-
break
42-
}
43-
39+
for warehouse.Get(tmp) == 'O' {
4440
tmp = tmp.Add(m)
4541
}
4642

go/2024/puzzles/day18/main.go

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,7 @@ func part2(name string, size int) string {
3434
low := 0
3535
high := len(bytes) - 1
3636

37-
for {
38-
if low >= high {
39-
break
40-
}
41-
37+
for low < high {
4238
middle := (low + high) / 2
4339
minCost := findPath(bytes, size, middle+1)
4440

go/2024/puzzles/day19/main.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,7 @@ func onsenTowelDesign(name string) (int, int) {
3030
patterns := lines[1]
3131
possibleDesigns, totalPossibleDesigns := 0, 0
3232

33-
for _, l := range strings.Split(lines[0][0], ", ") {
34-
designs = append(designs, l)
35-
}
33+
designs = append(designs, strings.Split(lines[0][0], ", ")...)
3634

3735
var ways func(string) int
3836
designLibrary := map[string]int{}

go/2025/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ Using Go's built-in benchmarking with the [testing](https://pkg.go.dev/testing#h
3636
| 3 | 209025 | 276642 | `5,57%` |
3737
| 4 | 214451 | 5483916 | |
3838
| 5 | 116258 | 68155 | `96,29%` / - |
39-
| 6 | 164777 | 986335 | `24,15%` / - |
39+
| 6 | 149919 | 986335 | `30,99%` / - |
4040

4141
\* compared to first solution
4242

go/2025/puzzles/day02/main.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,8 @@ func part2(name string) (invalid int) {
7777

7878
func inclusiveRange(name string) (output []int) {
7979
line := strings.TrimSpace(files.Read(name))
80-
ranges := strings.Split(line, ",")
8180

82-
for _, r := range ranges {
81+
for r := range strings.SplitSeq(line, ",") {
8382
s, e, _ := strings.Cut(r, "-")
8483
start := utils.MustIntFromString(s)
8584
end := utils.MustIntFromString(e)

go/2025/puzzles/day06/main.go

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,7 @@ func part1(name string) (grandTotal int) {
3434
last := len(lines) - 1
3535

3636
for _, line := range lines[:last] {
37-
inner := []string{}
38-
39-
for digit := range strings.FieldsSeq(line) {
40-
inner = append(inner, digit)
41-
}
42-
43-
data = append(data, inner)
37+
data = append(data, strings.Fields(line))
4438
}
4539

4640
// Basically a zip

0 commit comments

Comments
 (0)