added template for easier start

This commit is contained in:
Michael Bobbitt 2024-12-20 01:08:11 -05:00
parent 7ecffd293b
commit 0ece305db0
2 changed files with 40 additions and 0 deletions

36
template/main.go Normal file
View File

@ -0,0 +1,36 @@
package main
import (
"fmt"
"os"
)
func main() {
if len(os.Args) < 2 {
panic("Provide input file")
}
inputFile := os.Args[1]
part1, part2 := solution(inputFile)
fmt.Printf("(%s) Part 1: %d\n(%s) Part 2: %d\n", inputFile, part1, inputFile, part2)
}
func solution(inputFile string) (int, int) {
var part1, part2 int
// Read line by line
// input, err := os.Open(inputFile)
// if err != nil {
// panic(err)
// }
// defer input.Close()
// read whole file
// input, err := os.ReadFile(inputFile)
// if err != nil {
// panic(err)
// }
// fmt.Println(string(input))
return part1, part2
}

4
template/run Executable file
View File

@ -0,0 +1,4 @@
#!/bin/bash
go build -o ./bin/solution ./main.go
./bin/solution "$1"