mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
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:
parent
9532810f76
commit
f08d1090d0
@ -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
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user