From 551effe26e8b552c3f8a5a2bdb4f7408663a5047 Mon Sep 17 00:00:00 2001 From: Edward Muller Date: Mon, 16 May 2016 10:48:31 -0700 Subject: [PATCH] `devel-` is newer Consider devel versions newer than released go versions. This may not always be the case, but is probably the sanest default. --- Changelog.md | 4 ++++ match_test.go | 1 + version.go | 5 ++++- 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/Changelog.md b/Changelog.md index b41e59e..3c72c11 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,3 +1,7 @@ +#v68 (2016/06/16) + +* `devel-` is always considered newer than any released go version + #v67 (2016/06/13) * Attempt to handle missing deps a little better. diff --git a/match_test.go b/match_test.go index 502bd0d..67fc20f 100644 --- a/match_test.go +++ b/match_test.go @@ -71,6 +71,7 @@ func TestIsSameOrNewer(t *testing.T) { {`go1.6`, `go1.6`, true}, {`go1.5`, `go1.6`, true}, {`go1.7`, `go1.6`, false}, + {`go1.6`, `devel-8f48efb`, true}, // devel versions are always never } for _, test := range cases { diff --git a/version.go b/version.go index 17fc234..f07cb5d 100644 --- a/version.go +++ b/version.go @@ -8,7 +8,7 @@ import ( "strings" ) -const version = 67 +const version = 68 var cmdVersion = &Command{ Name: "version", @@ -39,6 +39,9 @@ func isSameOrNewer(base, check string) bool { if base == check { return true } + if strings.HasPrefix(check, "devel-") { + return true + } bp := strings.FieldsFunc(base, GoVersionFields) cp := strings.FieldsFunc(check, GoVersionFields) if len(bp) < 2 || len(cp) < 2 {