summaryrefslogtreecommitdiff
path: root/aoc/scanner.go
diff options
context:
space:
mode:
Diffstat (limited to 'aoc/scanner.go')
-rw-r--r--aoc/scanner.go15
1 files changed, 15 insertions, 0 deletions
diff --git a/aoc/scanner.go b/aoc/scanner.go
new file mode 100644
index 0000000..733f49a
--- /dev/null
+++ b/aoc/scanner.go
@@ -0,0 +1,15 @@
+package aoc
+
+import (
+ "bufio"
+ "log"
+ "os"
+)
+
+func NewScannerFromFile(filename string) *bufio.Scanner {
+ f, err := os.Open(filename)
+ if err != nil {
+ log.Panic(err)
+ }
+ return bufio.NewScanner(f)
+}