Move to Go modules (#10)

This commit is contained in:
2019-10-13 08:55:38 +00:00
committed by Gitea
parent 2159aadfcb
commit 6207229e9b
478 changed files with 148676 additions and 20886 deletions

View File

@@ -4,6 +4,7 @@ import (
"fmt"
"regexp"
"strconv"
"strings"
)
type (
@@ -22,7 +23,7 @@ const (
)
var (
pattern = regexp.MustCompile(`(?i)^(-?\d+(?:\.\d+)?)([KMGTPE]B?|B?)$`)
pattern = regexp.MustCompile(`(?i)^(-?\d+(?:\.\d+)?)\s?([KMGTPE]B?|B?)$`)
global = New()
)
@@ -73,7 +74,7 @@ func (*Bytes) Parse(value string) (i int64, err error) {
return 0, fmt.Errorf("error parsing value=%s", value)
}
bytesString := parts[1]
multiple := parts[2]
multiple := strings.ToUpper(parts[2])
bytes, err := strconv.ParseFloat(bytesString, 64)
if err != nil {
return