diff options
author | Martin Czygan <martin.czygan@gmail.com> | 2021-05-15 00:42:51 +0200 |
---|---|---|
committer | Martin Czygan <martin.czygan@gmail.com> | 2021-05-15 00:42:51 +0200 |
commit | 7fb9c24e4ee39d3a642a47ecbbb094c37394f57a (patch) | |
tree | 6e2ffeb36afe9ea02615e31534f74880ec415def /skate | |
parent | 4455f287b73a2c8d3ebb467a40028a20cafae672 (diff) | |
download | refcat-7fb9c24e4ee39d3a642a47ecbbb094c37394f57a.tar.gz refcat-7fb9c24e4ee39d3a642a47ecbbb094c37394f57a.zip |
move out groupLogf
Diffstat (limited to 'skate')
-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 |