diff --git a/cmd/core-agent/update.go b/cmd/core-agent/update.go index 5f6a114..328e03f 100644 --- a/cmd/core-agent/update.go +++ b/cmd/core-agent/update.go @@ -2,7 +2,10 @@ package main -import agentpkg "dappco.re/go/agent" +import ( + agentpkg "dappco.re/go/agent" + core "dappco.re/go/core" +) // agentpkg.Version = "0.15.0" // updateChannel() // "stable" @@ -10,7 +13,7 @@ func updateChannel() string { switch { case agentpkg.Version == "" || agentpkg.Version == "dev": return "dev" - case agentpkg.Version != "" && (agentpkg.Version[len(agentpkg.Version)-1] >= 'a'): + case core.Contains(agentpkg.Version, "-"): return "prerelease" default: return "stable" diff --git a/cmd/core-agent/update_test.go b/cmd/core-agent/update_test.go index 8111dd9..3d07608 100644 --- a/cmd/core-agent/update_test.go +++ b/cmd/core-agent/update_test.go @@ -43,8 +43,7 @@ func TestUpdate_UpdateChannelNumericSuffix_Ugly(t *testing.T) { t.Cleanup(func() { agentpkg.Version = "" }) - // Ends in '1' which is < 'a', so stable - assert.Equal(t, "stable", updateChannel()) + assert.Equal(t, "prerelease", updateChannel()) } func TestUpdate_ApplicationVersion_Good(t *testing.T) {