Skip to content

Commit c88efed

Browse files
committed
AoC 2024, Day 1: Read input file
1 parent 0af257d commit c88efed

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

go/2024/day01.go

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,23 @@
11
package main
22

3-
import "fmt"
3+
import (
4+
"bufio"
5+
"fmt"
6+
"os"
7+
)
48

59
func main() {
6-
fmt.Println("hello world")
10+
fi, err := os.Open("day01.txt")
11+
12+
if err != nil {
13+
panic(err)
14+
}
15+
16+
defer fi.Close()
17+
18+
scanner := bufio.NewScanner(fi)
19+
20+
for scanner.Scan() {
21+
fmt.Println(scanner.Text())
22+
}
723
}

0 commit comments

Comments
 (0)