started loader refactoring

This commit is contained in:
Radu Ioan Fericean
2015-05-25 14:40:41 +03:00
parent 364f74c6c8
commit ccd91e36ae
6 changed files with 413 additions and 384 deletions

View File

@@ -110,16 +110,14 @@ func (csvr *CSVReader) LoadDestinations() (err error) {
if fp != nil {
defer fp.Close()
}
var tpDests []*TpDestination
for record, err := csvReader.Read(); err == nil; record, err = csvReader.Read() {
tag := record[0]
var dest *Destination
var found bool
if dest, found = csvr.tp.destinations[tag]; !found {
dest = &Destination{Id: tag}
csvr.tp.destinations[tag] = dest
}
dest.AddPrefix(record[1])
tpDest := &TpDestination{}
tpDest.Load(record)
tpDests = append(tpDests, tpDest)
//log.Printf("%+v\n", tpDest)
}
csvr.tp.LoadDestinations(tpDests)
return
}