aboutsummaryrefslogtreecommitdiffstats
path: root/skate/zippy.go
diff options
context:
space:
mode:
Diffstat (limited to 'skate/zippy.go')
-rw-r--r--skate/zippy.go12
1 files changed, 10 insertions, 2 deletions
diff --git a/skate/zippy.go b/skate/zippy.go
index fc188a9..b7a3bef 100644
--- a/skate/zippy.go
+++ b/skate/zippy.go
@@ -3,6 +3,7 @@ package skate
import (
"fmt"
"io"
+ "log"
"strings"
"git.archive.org/martin/cgraph/skate/zipkey"
@@ -15,8 +16,13 @@ import (
// and assigns a fixed match result. XXX: allow empty keys
func ZippyExact(releases, refs io.Reader, matchResult MatchResult, w io.Writer) error {
var (
- enc = json.NewEncoder(w)
- keyer = makeKeyFunc("\t", 1)
+ enc = json.NewEncoder(w)
+ keyer = makeKeyFunc("\t", 1)
+ groupLogf = func(g *zipkey.Group, s string, vs ...interface{}) {
+ log.Printf(s, vs)
+ b, _ := json.Marshal(g)
+ log.Println(string(b))
+ }
grouper = func(g *zipkey.Group) error {
var (
target *Release
@@ -27,10 +33,12 @@ func ZippyExact(releases, refs io.Reader, matchResult MatchResult, w io.Writer)
return nil
}
if target, err = stringToRelease(cut(g.G0[0], "\t", 2)); err != nil {
+ groupLogf(g, "failed to parse release: %v", err)
return err
}
for _, line := range g.G1 {
if ref, err = stringToRef(cut(line, "\t", 2)); err != nil {
+ groupLogf(g, "failed to parse ref: %v", err)
return err
}
var bref BiblioRef