Browse Source

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.
Yicheng Qin 11 years ago
parent
commit
f08d1090d0
1 changed files with 1 additions and 5 deletions
  1. 1 5
      wal/util.go

+ 1 - 5
wal/util.go

@@ -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
 }