If no delete orgs file supplied, delete all records

This commit is contained in:
Bryan Boreham
2019-06-08 11:24:35 +00:00
parent 654c26442c
commit 15546dc690

View File

@@ -171,8 +171,8 @@ func main() {
}
func setupOrgs(deleteOrgsFile string) (deleteOrgs map[int]struct{}) {
deleteOrgs = map[int]struct{}{}
if deleteOrgsFile != "" {
deleteOrgs = map[int]struct{}{}
content, err := ioutil.ReadFile(deleteOrgsFile)
checkFatal(err)
for _, arg := range strings.Fields(string(content)) {
@@ -190,8 +190,10 @@ func (sc *scanner) HandleRecord(ctx context.Context, deleteOrgs map[int]struct{}
fields = strings.Split(fields[0], "-")
org, err := strconv.Atoi(fields[0])
checkFatal(err)
if _, found := deleteOrgs[org]; !found {
return
if deleteOrgs != nil {
if _, found := deleteOrgs[org]; !found {
return
}
}
hour, err := strconv.Atoi(fields[1])
checkFatal(err)