Permalink
Browse files

common/hugo: Use official semver even for main releases

Closes #5639
  • Loading branch information...
bep committed Feb 1, 2019
1 parent c7c66e6 commit fab41f42d3e23c11651ab75413b01d97e5d37c30
Showing with 10 additions and 1 deletion.
  1. +1 −1 common/hugo/version.go
  2. +9 −0 common/hugo/version_test.go
@@ -149,7 +149,7 @@ func BuildVersionString() string {
}

func version(version float32, patchVersion int, suffix string) string {
if patchVersion > 0 {
if patchVersion > 0 || version > 0.53 {

This comment has been minimized.

@myitcv

myitcv Feb 1, 2019

@bep in case it's useful, github.com/rogpeppe/go-internal/semver was factored out of the cmd/go internals.

return fmt.Sprintf("%.2f.%d%s", version, patchVersion, suffix)
}
return fmt.Sprintf("%.2f%s", version, suffix)
@@ -35,6 +35,15 @@ func TestHugoVersion(t *testing.T) {
require.False(t, nextVersionString.Eq("0.21"))
require.True(t, nextVersionString.Eq(nextVersionString))
require.Equal(t, "0.20.3", v.NextPatchLevel(3).String())

// We started to use full semver versions even for main
// releases in v0.54.0
v = Version{Number: 0.53, PatchLevel: 0}
require.Equal(t, "0.53", v.String())
require.Equal(t, "0.54.0", v.Next().String())
require.Equal(t, "0.55.0", v.Next().Next().String())
v = Version{Number: 0.54, PatchLevel: 0, Suffix: "-DEV"}
require.Equal(t, "0.54.0-DEV", v.String())
}

func TestCompareVersions(t *testing.T) {

0 comments on commit fab41f4

Please sign in to comment.