Skip to content

Commit

Permalink
Handle error of hostMap.Del(...)
Browse files Browse the repository at this point in the history
  • Loading branch information
kchason committed Sep 7, 2023
1 parent 5b2a593 commit 0274db4
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions v2/pkg/core/inputs/hybrid/hmap.go
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,11 @@ func (i *Input) setItem(metaInput *contextargs.MetaInput, exclude bool) {
// Otherwise, increment the dupeCount and don't bother adding it to the stream
if exclude {
i.excludedCount++
i.hostMap.Del(key)
err := i.hostMap.Del(key)
if err != nil {
gologger.Error().Msgf("Error excluding target from list: %s", key)
return
}
gologger.Info().Msgf("Excluding target from target list: %s", key)
} else {
i.dupeCount++
Expand Down Expand Up @@ -385,7 +389,11 @@ func (i *Input) expandCIDRInputValue(value string, exclude bool) {
// map. Otherwise, increment the dupeCount and don't bother adding it to the stream
if exclude {
i.excludedCount++
i.hostMap.Del(key)
err := i.hostMap.Del(key)
if err != nil {
gologger.Error().Msgf("Error excluding target from list: %s", key)
return
}
gologger.Info().Msgf("Excluding target from target list: %s", key)
} else {
i.dupeCount++
Expand Down

0 comments on commit 0274db4

Please sign in to comment.