mirror of
https://github.com/caddyserver/caddy.git
synced 2024-11-26 02:09:47 +08:00
6fde3632ef
The vendor/ folder was created with the help of @FiloSottile's gvt and vendorcheck. Any dependencies of Caddy plugins outside this repo are not vendored. We do not remove any unused, vendored packages because vendorcheck -u only checks using the current build configuration; i.e. packages that may be imported by files toggled by build tags of other systems. CI tests have been updated to ignore the vendor/ folder. When Go 1.9 is released, a few of the go commands should be revised to again use ./... as it will ignore the vendor folder by default.
27 lines
650 B
Go
27 lines
650 B
Go
package units
|
|
|
|
// SI units.
|
|
type SI int64
|
|
|
|
// SI unit multiples.
|
|
const (
|
|
Kilo SI = 1000
|
|
Mega = Kilo * 1000
|
|
Giga = Mega * 1000
|
|
Tera = Giga * 1000
|
|
Peta = Tera * 1000
|
|
Exa = Peta * 1000
|
|
)
|
|
|
|
func MakeUnitMap(suffix, shortSuffix string, scale int64) map[string]float64 {
|
|
return map[string]float64{
|
|
shortSuffix: 1,
|
|
"K" + suffix: float64(scale),
|
|
"M" + suffix: float64(scale * scale),
|
|
"G" + suffix: float64(scale * scale * scale),
|
|
"T" + suffix: float64(scale * scale * scale * scale),
|
|
"P" + suffix: float64(scale * scale * scale * scale * scale),
|
|
"E" + suffix: float64(scale * scale * scale * scale * scale * scale),
|
|
}
|
|
}
|