diff --git a/aoc b/aoc index a535883..0ddd971 100644 --- a/aoc +++ b/aoc @@ -16,6 +16,7 @@ CHALLENGES_DIR = "challenges" SAMPLE_TEST_JSON = "{}" RUNNERS = { "py": ["python3"], + "go": ["go", "run"], } diff --git a/templates/main.go b/templates/main.go new file mode 100644 index 0000000..7747e24 --- /dev/null +++ b/templates/main.go @@ -0,0 +1,44 @@ +package main + +import ( + "fmt" + "io" + "os" + "strings" +) + +func parse(instr string) any { + return nil +} + +func one(instr string) int { + return -1 +} + +func two(instr string) int { + return -1 +} + +func main() { + if len(os.Args) < 2 || !(os.Args[1] == "1" || os.Args[1] == "2") { + debug("Missing day argument") + os.Exit(1) + } + + inp, err := io.ReadAll(os.Stdin) + if err != nil { + panic(err) + } + inpStr := strings.TrimSpace(string(inp)) + + switch os.Args[1] { + case "1": + fmt.Println(one(inpStr)) + case "2": + fmt.Println(two(inpStr)) + } +} + +func debug(f string, sub ...any) { + fmt.Fprintf(os.Stderr, f, sub...) +}