diff --git a/day-01/cmd/cli/main.go b/day-01/cmd/cli/main.go index 428ce96..ff122ab 100644 --- a/day-01/cmd/cli/main.go +++ b/day-01/cmd/cli/main.go @@ -25,5 +25,10 @@ func main() { log.Fatal(err) } - problems.Solve(data) + one, two, err := problems.Solve(data) + if err != nil { + log.Fatal(err) + } + + fmt.Printf("solution one: %d\nsolution two: %d\n", one, two) } diff --git a/day-01/solve.go b/day-01/solve.go index 39d0613..9825d8d 100644 --- a/day-01/solve.go +++ b/day-01/solve.go @@ -1,23 +1,20 @@ -package day01 +package dayone import ( - "fmt" - "log" - "github.com/onyx-and-iris/aoc2024/day-01/internal/one" "github.com/onyx-and-iris/aoc2024/day-01/internal/two" ) -func Solve(data []byte) { - val, err := one.Solve(data) +func Solve(data []byte) (int, int, error) { + answerOne, err := one.Solve(data) if err != nil { - log.Fatal(err) + return 0, 0, err } - fmt.Printf("solution one: %d\n", val) - val, err = two.Solve(data) + answerTwo, err := two.Solve(data) if err != nil { - log.Fatal(err) + return 0, 0, err } - fmt.Printf("solution two: %d\n", val) + + return answerOne, answerTwo, nil } diff --git a/day-01/solve_internal_test.go b/day-01/solve_internal_test.go index 151cb6f..1c00798 100644 --- a/day-01/solve_internal_test.go +++ b/day-01/solve_internal_test.go @@ -1,4 +1,4 @@ -package day01 +package dayone import ( _ "embed"