Watch
1
0
Fork
You've already forked advent-of-code
0

2021 Day 4

This commit is contained in:
Jeremy Kaplan 2021-12-03 22:13:57 -08:00
commit 739b9080ab
4 changed files with 185 additions and 0 deletions

View file

@ -3,6 +3,8 @@ package aoc
import (
"bufio"
"os"
"strconv"
"strings"
)
func ReadLines(path string) (lines []string) {
@ -18,3 +20,19 @@ func ReadLines(path string) (lines []string) {
}
return lines
}
func ReadFile(path string) string {
b, err := os.ReadFile(path)
if err != nil {
panic(err)
}
return strings.TrimSpace(string(b))
}
func MustInt(s string) int {
i, err := strconv.Atoi(s)
if err != nil {
panic(err)
}
return i
}