diff --git a/cmd/badges/main.go b/cmd/badges/main.go index 224e4016e..bdd1dcc53 100644 --- a/cmd/badges/main.go +++ b/cmd/badges/main.go @@ -78,7 +78,7 @@ func formatCount(count float64) string { for _, v := range ranges { if count >= v.val { - t := fmt.Sprintf("%.1f", math.Round(count/v.val)) + t := fmt.Sprintf("%.1f", math.Ceil(count/v.val*10)/10) if len(t) > 3 { t = t[:strings.Index(t, ".")] diff --git a/cmd/badges/main_test.go b/cmd/badges/main_test.go index d4a99d2e6..e1db700c7 100644 --- a/cmd/badges/main_test.go +++ b/cmd/badges/main_test.go @@ -1,8 +1,6 @@ package main import ( - "fmt" - "math" "testing" ) @@ -32,9 +30,6 @@ func Test_processPath(t *testing.T) { } func Test_formatCount(t *testing.T) { - - fmt.Println(math.Round(2500 / 1000)) - type args struct { count float64 } @@ -76,7 +71,7 @@ func Test_formatCount(t *testing.T) { args: args{ count: 263804, }, - want: "264k", + want: "263k", }, { name: "",