remove lineBytes

This commit is contained in:
onyx-and-iris 2024-12-13 14:47:56 +00:00
parent fde954f97c
commit f7534c78d1

View File

@ -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)