mirror of
https://github.com/onyx-and-iris/aoc2024.git
synced 2025-01-10 06:40:47 +00:00
remove lineBytes
This commit is contained in:
parent
fde954f97c
commit
f7534c78d1
@ -19,16 +19,16 @@ func ParseLines(r io.Reader) ([]*machine.Machine, error) {
|
|||||||
|
|
||||||
scanner := bufio.NewScanner(r)
|
scanner := bufio.NewScanner(r)
|
||||||
for scanner.Scan() {
|
for scanner.Scan() {
|
||||||
lineBytes := scanner.Bytes()
|
line := scanner.Text()
|
||||||
if len(lineBytes) == 0 {
|
if len(line) == 0 {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
var m []string
|
var m []string
|
||||||
switch line := string(lineBytes); {
|
switch line := line; {
|
||||||
case reButton.Match(lineBytes):
|
case reButton.MatchString(line):
|
||||||
m = reButton.FindStringSubmatch(line)
|
m = reButton.FindStringSubmatch(line)
|
||||||
case rePrize.Match(lineBytes):
|
case rePrize.MatchString(line):
|
||||||
m = rePrize.FindStringSubmatch(line)
|
m = rePrize.FindStringSubmatch(line)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -47,7 +47,7 @@ func ParseLines(r io.Reader) ([]*machine.Machine, error) {
|
|||||||
return machines, nil
|
return machines, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func mustConv(s string) int {
|
func MustConv(s string) int {
|
||||||
n, err := strconv.Atoi(s)
|
n, err := strconv.Atoi(s)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
|
Loading…
Reference in New Issue
Block a user