2021 Day 3
This commit is contained in:
parent
fdf70134e7
commit
c13f4ca236
2 changed files with 113 additions and 0 deletions
20
2021/aoc/aoc.go
Normal file
20
2021/aoc/aoc.go
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
package aoc
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
"os"
|
||||
)
|
||||
|
||||
func ReadLines(path string) (lines []string) {
|
||||
f, err := os.Open(path)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
defer f.Close()
|
||||
|
||||
scanner := bufio.NewScanner(f)
|
||||
for scanner.Scan() {
|
||||
lines = append(lines, scanner.Text())
|
||||
}
|
||||
return lines
|
||||
}
|
||||
Loading…
Reference in a new issue