Files
advent-of-code-2021/main.go.template
T
2021-12-01 13:42:07 -05:00

38 lines
515 B
Plaintext

/* Day #: */
package main
import (
"bufio"
"fmt"
"os"
)
func check(e error) {
if e != nil {
fmt.Println("Oh snap!")
panic(e)
}
}
func ReadAllLines(input *os.File) []string {
scanner := bufio.NewScanner(input)
var text []string
for scanner.Scan() {
text = append(text, scanner.Text())
}
return text
}
func main() {
input1, err := os.Open("./input.txt")
check(err)
text := ReadAllLines(input1)
input1.Close()
fmt.Printf("Read %d lines from %s\n", len(text), "input.txt")
fmt.Println()
}