mirror of
https://github.com/onyx-and-iris/aoc2024.git
synced 2025-01-09 14:20:48 +00:00
remove log.Fatal's from solve.go, return values back to main.
This commit is contained in:
parent
600d01660c
commit
67a04b91c8
@ -25,5 +25,10 @@ func main() {
|
|||||||
log.Fatal(err)
|
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)
|
||||||
}
|
}
|
||||||
|
@ -1,23 +1,20 @@
|
|||||||
package day01
|
package dayone
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
|
||||||
"log"
|
|
||||||
|
|
||||||
"github.com/onyx-and-iris/aoc2024/day-01/internal/one"
|
"github.com/onyx-and-iris/aoc2024/day-01/internal/one"
|
||||||
"github.com/onyx-and-iris/aoc2024/day-01/internal/two"
|
"github.com/onyx-and-iris/aoc2024/day-01/internal/two"
|
||||||
)
|
)
|
||||||
|
|
||||||
func Solve(data []byte) {
|
func Solve(data []byte) (int, int, error) {
|
||||||
val, err := one.Solve(data)
|
answerOne, err := one.Solve(data)
|
||||||
if err != nil {
|
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 {
|
if err != nil {
|
||||||
log.Fatal(err)
|
return 0, 0, err
|
||||||
}
|
}
|
||||||
fmt.Printf("solution two: %d\n", val)
|
|
||||||
|
return answerOne, answerTwo, nil
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
package day01
|
package dayone
|
||||||
|
|
||||||
import (
|
import (
|
||||||
_ "embed"
|
_ "embed"
|
||||||
|
Loading…
Reference in New Issue
Block a user