func initLastRecord() { s := progressLog.LastRecord() var err error = nil if s == string(record.DefaultRecord.Format()) { lastRecord = getValidRecord() } else { if lastRecord, err = record.ParseCRCRecord(s); err != nil { lastRecord = getValidRecord() } } }
func getValidRecord() *record.Record { for { s, err := recordFile.Readln() if err != nil { exitLog.Println(err) panic(err) } else { progressLog.Insert([]byte(s)) } if r, err := record.ParseCRCRecord(s); err == nil { return r } else { errLog.Insertln(s) } } }