remove internal/util

This commit is contained in:
2025-01-07 17:20:07 +00:00
parent a6295375aa
commit feb0ae4617
4 changed files with 16 additions and 11 deletions

View File

@@ -5,8 +5,6 @@ import (
"bytes"
"io"
"regexp"
"github.com/onyx-and-iris/aoc2024/day-03/internal/util"
)
var reMul = regexp.MustCompile(`mul\(([0-9]{1,3}),([0-9]{1,3})\)`)
@@ -28,7 +26,7 @@ func parseLines(r io.Reader) (int, error) {
for scanner.Scan() {
matches := reMul.FindAllStringSubmatch(scanner.Text(), -1)
for _, m := range matches {
sum += util.MustConv(m[1]) * util.MustConv(m[2])
sum += mustConv(m[1]) * mustConv(m[2])
}
}

View File

@@ -0,0 +1,11 @@
package one
import "strconv"
func mustConv(s string) int {
n, err := strconv.Atoi(s)
if err != nil {
panic(err)
}
return n
}