1
0
mirror of https://github.com/divan/expvarmon.git synced 2025-05-10 19:29:17 +08:00

Hardcode float64 output precision to .2

This commit is contained in:
Ivan Daniluk 2015-05-02 22:45:33 +03:00
parent 9dba7d8b7e
commit 9b291c4cba

4
var.go
View File

@ -95,5 +95,9 @@ func Format(v VarValue, kind VarKind) string {
return fmt.Sprintf("%s", time.Duration(v.(int64)))
}
if f, ok := v.(float64); ok {
return fmt.Sprintf("%.2f", f)
}
return fmt.Sprintf("%v", v)
}