Skip to content

Commit

Permalink
Merge pull request #56 from rebuy-de/improve-versions
Browse files Browse the repository at this point in the history
be more tolerant when checking versions
  • Loading branch information
svenwltr authored Oct 7, 2020
2 parents 6fba9b1 + e54f021 commit bc19049
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion cmd/buildutil/info.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func ParseVersion(s string) (Version, error) {
err error

reCore = regexp.MustCompile(`^v?([0-9]+)\.([0-9]+)\.([0-9]+)([\-\+].+)?$`)
rePreRelease = regexp.MustCompile(`^\+(alpha|beta|rc)\.[0-9]+$`)
rePreRelease = regexp.MustCompile(`^[\-\+](alpha|beta|rc)\.?[0-9]+$`)
reDescribe = regexp.MustCompile(`\-([0-9]+)-g?([0-9a-f]+)(-dirty)?$`)
)

Expand Down
5 changes: 5 additions & 0 deletions cmd/buildutil/info_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,11 @@ func TestParseVersion(t *testing.T) {
in: "v1.6.0+alpha.1-20-gb9e9373-dirty",
out: "v1.6.0+dirty.20.b9e9373",
},
{
name: "release-candidate",
in: "v3.0.0-rc2",
out: "v3.0.0+rc2",
},
}

for _, tc := range cases {
Expand Down

0 comments on commit bc19049

Please sign in to comment.