del no use code
This commit is contained in:
parent
be84d84de1
commit
0153264fa9
|
@ -6,7 +6,6 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"log"
|
"log"
|
||||||
"strconv"
|
|
||||||
"strings"
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
"sync/atomic"
|
"sync/atomic"
|
||||||
|
@ -748,22 +747,22 @@ func hostnameFromID(id string) string {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Parses the human-readable size string into the amount it represents.
|
// Parses the human-readable size string into the amount it represents.
|
||||||
func parseSize(sizeStr string) (int64, error) {
|
// func parseSize(sizeStr string) (int64, error) {
|
||||||
matches := sizeRegex.FindStringSubmatch(sizeStr)
|
// matches := sizeRegex.FindStringSubmatch(sizeStr)
|
||||||
if len(matches) != 4 {
|
// if len(matches) != 4 {
|
||||||
return -1, fmt.Errorf("invalid size: %s", sizeStr)
|
// return -1, fmt.Errorf("invalid size: %s", sizeStr)
|
||||||
}
|
// }
|
||||||
|
|
||||||
size, err := strconv.ParseFloat(matches[1], 64)
|
// size, err := strconv.ParseFloat(matches[1], 64)
|
||||||
if err != nil {
|
// if err != nil {
|
||||||
return -1, err
|
// return -1, err
|
||||||
}
|
// }
|
||||||
|
|
||||||
uMap := map[string]int64{"k": KB, "m": MB, "g": GB, "t": TB, "p": PB}
|
// uMap := map[string]int64{"k": KB, "m": MB, "g": GB, "t": TB, "p": PB}
|
||||||
unitPrefix := strings.ToLower(matches[3])
|
// unitPrefix := strings.ToLower(matches[3])
|
||||||
if mul, ok := uMap[unitPrefix]; ok {
|
// if mul, ok := uMap[unitPrefix]; ok {
|
||||||
size *= float64(mul)
|
// size *= float64(mul)
|
||||||
}
|
// }
|
||||||
|
|
||||||
return int64(size), nil
|
// return int64(size), nil
|
||||||
}
|
// }
|
||||||
|
|
Loading…
Reference in New Issue