diff options
-rw-r--r-- | skate/zippy.go | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/skate/zippy.go b/skate/zippy.go index b7a3bef..237162f 100644 --- a/skate/zippy.go +++ b/skate/zippy.go @@ -12,18 +12,25 @@ import ( // This file contains the two-stream (zippy) matchers. +// groupLogf logs a message and a serialized group. +func groupLogf(g *zipkey.Group, s string, vs ...interface{}) { + log.Printf(s, vs...) + b, _ := json.Marshal(g) + log.Println(string(b)) +} + // ZippyExact takes a release and refs reader (tsv, with ident, key, doc) // 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) - groupLogf = func(g *zipkey.Group, s string, vs ...interface{}) { - log.Printf(s, vs) - b, _ := json.Marshal(g) - log.Println(string(b)) - } + enc = json.NewEncoder(w) + keyer = makeKeyFunc("\t", 1) + i = 0 grouper = func(g *zipkey.Group) error { + i++ + if i%10000 == 0 { + log.Printf("processed %v groups", i) + } var ( target *Release ref *Ref |