2021 Day 4
This commit is contained in:
parent
c13f4ca236
commit
739b9080ab
4 changed files with 185 additions and 0 deletions
|
|
@ -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
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue