Skip to content

Commit

Permalink
improve: don't output an empty slice when there are 0 entries.
Browse files Browse the repository at this point in the history
  • Loading branch information
lupinthe14th committed Jan 16, 2021
1 parent 24bd919 commit a397ffe
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions search.go
Original file line number Diff line number Diff line change
Expand Up @@ -205,11 +205,13 @@ func searchAction(c *cli.Context) error {
}
}
bar.Finish()
out, err := json.Marshal(&amplitudeIDs)
if err != nil {
return err
if len(amplitudeIDs) > 0 {
out, err := json.Marshal(&amplitudeIDs)
if err != nil {
return err
}
fmt.Fprintf(w, "%v\n", string(out))
}
fmt.Fprintf(w, "%v\n", string(out))

log.Debug().Msgf("amplitude Id count: %v", len(amplitudeIDs))
log.Debug().Msgf(
Expand Down

0 comments on commit a397ffe

Please sign in to comment.