Add Go support
This commit is contained in:
parent
2096f0eeaa
commit
7384395c35
2 changed files with 45 additions and 0 deletions
1
aoc
1
aoc
|
@ -16,6 +16,7 @@ CHALLENGES_DIR = "challenges"
|
||||||
SAMPLE_TEST_JSON = "{}"
|
SAMPLE_TEST_JSON = "{}"
|
||||||
RUNNERS = {
|
RUNNERS = {
|
||||||
"py": ["python3"],
|
"py": ["python3"],
|
||||||
|
"go": ["go", "run"],
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
44
templates/main.go
Normal file
44
templates/main.go
Normal file
|
@ -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...)
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue