diff options
Diffstat (limited to 'cleaner.go')
-rw-r--r-- | cleaner.go | 12 |
1 files changed, 6 insertions, 6 deletions
@@ -13,7 +13,7 @@ const ( DATABASE_PASS = "pass" DATABASE_CONNECTION = "" //e.g. "tcp(localhost:55555) DATABASE_NAME = "netflow" - MAXIMUM_ENTRIES = 1 + MAXIMUM_ENTRIES = 100 TIMESPAN = "day" ) @@ -134,15 +134,15 @@ func clean(rDat []RawData) (cDat []CleanData, err error) { func removeDups(cDat []CleanData) []CleanData { ret := make([]CleanData, 0) var found bool - for _, d0 := range cDat { + for ci := range cDat { found = false //Check if an equal struct already is appended - for _, d1 := range ret { - if d1.equals(d0) { + for ri := range ret { + if ret[ri].equals(&cDat[ci]) { //If found, increase it occurances instead of //appending a new struct - d1.occurances += d0.occurances + ret[ri].occurances += cDat[ci].occurances found = true break } @@ -151,7 +151,7 @@ func removeDups(cDat []CleanData) []CleanData { if !found { //if no equal struct is found //append it - ret = append(ret, d0) + ret = append(ret, cDat[ci]) } } return ret |