You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

58 lines
1001 B

package main // import "git.elis.nu/etu/aoc2019/dayX"
import (
"bufio"
"fmt"
"log"
"os"
"time"
)
func main() {
log.Println("Starting program to solve 2019-12-XX")
// Store time to print out execution time
start := time.Now()
var rows []string
// Get file handler
file, err := os.Open(os.Args[1])
defer file.Close()
if err != nil {
log.Fatal("Failed to open file:", err)
}
// Begin parsing file
scanner := bufio.NewScanner(file)
for scanner.Scan() {
rows = append(rows, scanner.Text())
}
// Print eventual error from parsing the file
if err := scanner.Err(); err != nil {
log.Fatal(err)
}
// Log spent time
log.Printf("Spent %s on parsing input\n", time.Since(start))
start = time.Now()
part1(rows)
log.Printf("Spent %s on solving part1\n", time.Since(start))
start = time.Now()
part2(rows)
log.Printf("Spent %s on solving part2\n", time.Since(start))
}
func part1(rows []string) {
fmt.Println(rows)
}
func part2(rows []string) {
fmt.Println(rows)
}