diff options
Diffstat (limited to 'skate')
-rw-r--r-- | skate/zippy.go | 13 | ||||
-rw-r--r-- | skate/zippy_test.go | 2 |
2 files changed, 8 insertions, 7 deletions
diff --git a/skate/zippy.go b/skate/zippy.go index 59951e2..02d0428 100644 --- a/skate/zippy.go +++ b/skate/zippy.go @@ -408,19 +408,20 @@ func deduplicateBrefs(brefs []*BiblioRef) []*BiblioRef { } }) var ( - unique []*BiblioRef - seen = set.New() - // i int + seen = set.New() + i int ) for _, v := range brefs { if seen.Contains(v.Key) { continue } - unique = append(unique, v) + brefs[i] = v + i++ seen.Add(v.Key) } - log.Printf("trimmed brefs from %d to %d", len(brefs), len(unique)) - return unique + brefs = brefs[:i] + log.Printf("trimmed brefs from %d to %d", len(brefs), i) + return brefs } // matchedRefsExtend takes a set of (unique) biblioref docs and will emit that diff --git a/skate/zippy_test.go b/skate/zippy_test.go index 4c9ed32..2a48c9b 100644 --- a/skate/zippy_test.go +++ b/skate/zippy_test.go @@ -320,7 +320,7 @@ func TestDeduplicateBrefs(t *testing.T) { }, { brefs: []*BiblioRef{}, - result: nil, + result: []*BiblioRef{}, }, { brefs: []*BiblioRef{ |