From 7ed364944513c46d2cb7dedc9c3c8f3859265174 Mon Sep 17 00:00:00 2001 From: Jille Timmermans Date: Mon, 9 Oct 2023 10:27:04 +0200 Subject: [PATCH] Replace RenderFloat with FormatFloat I suppose it was previously named RenderFloat --- number.go | 6 +++--- number_test.go | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/number.go b/number.go index 6470d0d..fc422af 100644 --- a/number.go +++ b/number.go @@ -46,7 +46,7 @@ var ( // * decimal separator // * decimal precision // -// Usage: s := RenderFloat(format, n) +// Usage: s := FormatFloat(format, n) // The format parameter tells how to render the number n. // // See examples: http://play.golang.org/p/LXc1Ddm1lJ @@ -111,7 +111,7 @@ func FormatFloat(format string, n float64) string { // +0000 if formatIndx[0] == 0 { if format[formatIndx[0]] != '+' { - panic("RenderFloat(): invalid positive sign directive") + panic("FormatFloat(): invalid positive sign directive") } positiveStr = "+" formatIndx = formatIndx[1:] @@ -125,7 +125,7 @@ func FormatFloat(format string, n float64) string { // 000,000.00 if len(formatIndx) == 2 { if (formatIndx[1] - formatIndx[0]) != 4 { - panic("RenderFloat(): thousands separator directive must be followed by 3 digit-specifiers") + panic("FormatFloat(): thousands separator directive must be followed by 3 digit-specifiers") } thousandStr = string(format[formatIndx[0]]) formatIndx = formatIndx[1:] diff --git a/number_test.go b/number_test.go index 516f337..f4767c3 100644 --- a/number_test.go +++ b/number_test.go @@ -52,8 +52,8 @@ func TestFormatFloat(t *testing.T) { } // Test the things that could panic panictests := []TestStruct{ - {"RenderFloat(): invalid positive sign directive", "-", 12345.6789, "12,345.68"}, - {"RenderFloat(): thousands separator directive must be followed by 3 digit-specifiers", "0.01", 12345.6789, "12,345.68"}, + {"FormatFloat(): invalid positive sign directive", "-", 12345.6789, "12,345.68"}, + {"FormatFloat(): thousands separator directive must be followed by 3 digit-specifiers", "0.01", 12345.6789, "12,345.68"}, } for _, test := range panictests { didPanic := false