From 9b291c4cba1ec8c79698139d0866b9f48000389e Mon Sep 17 00:00:00 2001 From: Ivan Daniluk Date: Sat, 2 May 2015 22:45:33 +0300 Subject: [PATCH] Hardcode float64 output precision to .2 --- var.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/var.go b/var.go index c383fec..38b23b1 100644 --- a/var.go +++ b/var.go @@ -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) }