Skip to content

Commit e9e2d96

Browse files
markkovariclaude
andauthored
fix: resolve Go test failures in 2019 and 2024 (#9)
* fix: resolve Go test failures in 2019 and 2024 - Remove unused 'errors' import in 2024/golang/cmd/04.go - Add filepath parameter to readCommands() function in 2019/go/cmd/15 to match test expectations 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> * fix: replace deprecated drain_filter with stable alternative in 2021/_4 - Remove unstable feature flag #![feature(drain_filter)] - Replace drain_filter with iter_mut + retain pattern - All Rust tests in 2021 now compile and pass 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent 86d7d0f commit e9e2d96

File tree

3 files changed

+5
-11
lines changed

3 files changed

+5
-11
lines changed

2019/go/cmd/15/main.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ import (
66
"strings"
77
)
88

9-
func readCommands() ([]int, error) {
9+
func readCommands(filepath string) ([]int, error) {
1010

11-
content, err := os.ReadFile("cmd/15/input.data")
11+
content, err := os.ReadFile(filepath)
1212
if err != nil {
1313
return []int{}, err
1414
}
@@ -27,7 +27,7 @@ func readCommands() ([]int, error) {
2727
}
2828
func main() {
2929

30-
nums, err := readCommands()
30+
nums, err := readCommands("cmd/15/input.data")
3131
if err != nil {
3232
println("was not able to read")
3333
}

2021/_4/src/main.rs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#![feature(drain_filter)]
21
use std::num::ParseIntError;
32
use std::str::FromStr;
43

@@ -129,12 +128,8 @@ fn main() {
129128
let mut found_table_indicies: Vec<usize> = vec![];
130129
// let tables_length = tables.len();
131130
for number in choosen_numbers.0 {
132-
tables = tables
133-
.drain_filter(|table| {
134-
table.toggle(number);
135-
table.found_full()
136-
})
137-
.collect();
131+
tables.iter_mut().for_each(|table| table.toggle(number));
132+
tables.retain(|table| !table.found_full());
138133
// tables.retain(|table| (*table).found_full())
139134
}
140135
// tables.retain(|table| {

2024/golang/cmd/04.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ package main
22

33
import (
44
"bufio"
5-
"errors"
65
"fmt"
76
"os"
87
"strings"

0 commit comments

Comments
 (0)