Skip to content

Commit

Permalink
Add support for remove records so they don't get reported
Browse files Browse the repository at this point in the history
  • Loading branch information
rdner committed Jan 26, 2023
1 parent 9e80eb1 commit 07b3952
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ type value struct {

type record struct {
Key string `json:"k"`
Value value `json:"v"`
Value *value `json:"v"`
}

func main() {
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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
}
}

0 comments on commit 07b3952

Please sign in to comment.