From a0e3ff16456c9bfaf57086197ebb3d3654dd98f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Pedersen?= Date: Wed, 1 Mar 2017 14:34:40 +0100 Subject: helpers: Fix version string for Hugo 0.20 and similar Fixes #3112 --- helpers/hugo.go | 8 ++++---- helpers/hugo_test.go | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'helpers') diff --git a/helpers/hugo.go b/helpers/hugo.go index d1dd57f4d..12d37b54d 100644 --- a/helpers/hugo.go +++ b/helpers/hugo.go @@ -50,14 +50,14 @@ func NextHugoReleaseVersion() string { func hugoVersion(version float32, patchVersion int, suffix string) string { if patchVersion > 0 { - return fmt.Sprintf("%.2g.%d%s", version, patchVersion, suffix) + return fmt.Sprintf("%.2f.%d%s", version, patchVersion, suffix) } - return fmt.Sprintf("%.2g%s", version, suffix) + return fmt.Sprintf("%.2f%s", version, suffix) } func hugoVersionNoSuffix(version float32, patchVersion int) string { if patchVersion > 0 { - return fmt.Sprintf("%.2g.%d", version, patchVersion) + return fmt.Sprintf("%.2f.%d", version, patchVersion) } - return fmt.Sprintf("%.2g", version) + return fmt.Sprintf("%.2f", version) } diff --git a/helpers/hugo_test.go b/helpers/hugo_test.go index 8dfa7f434..d901395e2 100644 --- a/helpers/hugo_test.go +++ b/helpers/hugo_test.go @@ -22,7 +22,7 @@ import ( func TestHugoVersion(t *testing.T) { assert.Equal(t, "0.15-DEV", hugoVersion(0.15, 0, "-DEV")) assert.Equal(t, "0.17", hugoVersionNoSuffix(0.16+0.01, 0)) - + assert.Equal(t, "0.20", hugoVersionNoSuffix(0.20, 0)) assert.Equal(t, "0.15.2-DEV", hugoVersion(0.15, 2, "-DEV")) assert.Equal(t, "0.17.3", hugoVersionNoSuffix(0.16+0.01, 3)) } -- cgit v1.2.3