From f08d1090d0d90d984a839d06823f85ca68395b54 Mon Sep 17 00:00:00 2001 From: Yicheng Qin Date: Thu, 8 Jan 2015 14:56:21 -0800 Subject: [PATCH] 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. --- wal/util.go | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/wal/util.go b/wal/util.go index 44a74cad2..1d57d4b0e 100644 --- a/wal/util.go +++ b/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 }