Skip to content

Commit

Permalink
common/hugo: Use official semver even for main releases
Browse files Browse the repository at this point in the history
Closes #5639
  • Loading branch information
bep committed Feb 1, 2019
1 parent c7c66e6 commit fab41f4
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion common/hugo/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Copy link
@myitcv

myitcv Feb 1, 2019

Contributor

@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)
Expand Down
9 changes: 9 additions & 0 deletions common/hugo/version_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit fab41f4

Please sign in to comment.