mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-21 20:46:30 -05:00
parent
cc15864744
commit
a0e3ff1645
2 changed files with 5 additions and 5 deletions
|
@ -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)
|
||||
}
|
||||
|
|
|
@ -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))
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue