wal: refine parseWalName function

According to http://godoc.org/fmt#Scan, if scan number is less than the
number of arguments, err will report why. So we don't need to handle
this error case.
This commit is contained in:
Yicheng Qin 2015-01-08 14:56:21 -08:00
parent 9532810f76
commit f08d1090d0

View File

@ -118,11 +118,7 @@ func checkWalNames(names []string) []string {
}
func parseWalName(str string) (seq, index uint64, err error) {
var num int
num, err = fmt.Sscanf(str, "%016x-%016x.wal", &seq, &index)
if num != 2 && err == nil {
err = fmt.Errorf("bad wal name: %s", str)
}
_, err = fmt.Sscanf(str, "%016x-%016x.wal", &seq, &index)
return
}