aboutsummaryrefslogtreecommitdiff
path: root/chksum/chksum.go
diff options
context:
space:
mode:
authorDimitri Sokolyuk <demon@dim13.org>2017-07-16 22:48:24 +0200
committerDimitri Sokolyuk <demon@dim13.org>2017-07-16 22:48:24 +0200
commit2fc8e0aeed3b36b20864a9eeba2bf08c806dcd5c (patch)
tree8939d90ca2cda9bc46e3f2f0826a09a3d7e31865 /chksum/chksum.go
parentf85e0d461fe80fe929eb5d82d9fec07eff810a93 (diff)
bikeshadding
Diffstat (limited to 'chksum/chksum.go')
-rw-r--r--chksum/chksum.go11
1 files changed, 6 insertions, 5 deletions
diff --git a/chksum/chksum.go b/chksum/chksum.go
index 2eefb52..847ae22 100644
--- a/chksum/chksum.go
+++ b/chksum/chksum.go
@@ -57,12 +57,13 @@ func Parse(data []byte) (Checklist, error) {
return parse(r)
}
+var line = regexp.MustCompile(`(\w+) \(([^)]+)\) = (\w+)`)
+
func parse(r io.Reader) (Checklist, error) {
var checklist Checklist
- re := regexp.MustCompile(`(\w+) \(([^)]+)\) = (\w+)`)
- scanner := bufio.NewScanner(r)
- for scanner.Scan() {
- match := re.FindStringSubmatch(scanner.Text())
+ s := bufio.NewScanner(r)
+ for s.Scan() {
+ match := line.FindStringSubmatch(s.Text())
if len(match) != 4 {
return nil, ErrParse
}
@@ -81,7 +82,7 @@ func parse(r io.Reader) (Checklist, error) {
}
checklist = append(checklist, cs)
}
- return checklist, scanner.Err()
+ return checklist, s.Err()
}
func (c Checksum) Check() error {