From 07b39523a585db8f455e30afe8732ca379263e56 Mon Sep 17 00:00:00 2001 From: Denis Rechkunov Date: Thu, 26 Jan 2023 17:55:06 +0100 Subject: [PATCH] Add support for remove records so they don't get reported --- main.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/main.go b/main.go index 4907447..89dc6e0 100644 --- a/main.go +++ b/main.go @@ -29,7 +29,7 @@ type value struct { type record struct { Key string `json:"k"` - Value value `json:"v"` + Value *value `json:"v"` } func main() { @@ -86,7 +86,7 @@ func analyse(filenames []string, workers int, buffer int) { } // incorrect data if source == "" { - log.Println("found an incompatible record without a source file") + log.Printf("found an incompatible record without a source file: %+v\n", record) continue } if _, ok := occurances[source]; !ok { @@ -160,6 +160,11 @@ func readRegistry(filename string, recordsCh chan<- record) error { if next.Key == "" { continue } + // it's a `remove` record + if next.Value == nil { + continue + } + recordsCh <- next } }