vendorize: update all vendorized packages. (#2206)

Bring in new changes from upstream for all the packages.

Important ones include
   - gorilla/mux
   - logrus
   - jwt
This commit is contained in:
Harshavardhana
2016-07-14 14:59:20 -07:00
committed by GitHub
parent b090c7112e
commit 35d438e0ff
84 changed files with 2546 additions and 1506 deletions

View File

@@ -41,7 +41,7 @@ func revfmap(in map[float64]string) map[string]float64 {
var riParseRegex *regexp.Regexp
func init() {
ri := `^([0-9.]+)([`
ri := `^([\-0-9.]+)\s?([`
for _, v := range siPrefixTable {
ri += v
}
@@ -61,18 +61,21 @@ func ComputeSI(input float64) (float64, string) {
if input == 0 {
return 0, ""
}
exponent := math.Floor(logn(input, 10))
mag := math.Abs(input)
exponent := math.Floor(logn(mag, 10))
exponent = math.Floor(exponent/3) * 3
value := input / math.Pow(10, exponent)
value := mag / math.Pow(10, exponent)
// Handle special case where value is exactly 1000.0
// Should return 1M instead of 1000k
if value == 1000.0 {
exponent += 3
value = input / math.Pow(10, exponent)
value = mag / math.Pow(10, exponent)
}
value = math.Copysign(value, input)
prefix := siPrefixTable[exponent]
return value, prefix
}
@@ -87,7 +90,7 @@ func ComputeSI(input float64) (float64, string) {
// e.g. SI(2.2345e-12, "F") -> 2.2345pF
func SI(input float64, unit string) string {
value, prefix := ComputeSI(input)
return Ftoa(value) + prefix + unit
return Ftoa(value) + " " + prefix + unit
}
var errInvalid = errors.New("invalid input")