Refactor all pre-compiled regexp to package level vars
Addresses #8057 Docker-DCO-1.1-Signed-off-by: Phil Estes <estesp@linux.vnet.ibm.com>
This commit is contained in:
parent
ed3d01687d
commit
c876988ae5
2 changed files with 8 additions and 10 deletions
|
@ -29,14 +29,9 @@ type unitMap map[string]int64
|
|||
var (
|
||||
decimalMap = unitMap{"k": KB, "m": MB, "g": GB, "t": TB, "p": PB}
|
||||
binaryMap = unitMap{"k": KiB, "m": MiB, "g": GiB, "t": TiB, "p": PiB}
|
||||
sizeRegex = regexp.MustCompile(`^(\d+)([kKmMgGtTpP])?[bB]?$`)
|
||||
)
|
||||
|
||||
var sizeRegex *regexp.Regexp
|
||||
|
||||
func init() {
|
||||
sizeRegex = regexp.MustCompile("^(\\d+)([kKmMgGtTpP])?[bB]?$")
|
||||
}
|
||||
|
||||
var unitAbbrs = [...]string{"B", "kB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"}
|
||||
|
||||
// HumanSize returns a human-readable approximation of a size
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue