Skip to content
This repository was archived by the owner on May 28, 2021. It is now read-only.

Commit 7377f35

Browse files
committed
Change to use semver to compare version
Not realized there already have semver can use before. Signed-off-by: Alan Tang <alantang888@gmail.com>
1 parent aa5924e commit 7377f35

File tree

1 file changed

+6
-12
lines changed

1 file changed

+6
-12
lines changed

pkg/resources/statefulsets/statefulset.go

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ import (
3434
"github.com/oracle/mysql-operator/pkg/resources/secrets"
3535
"github.com/oracle/mysql-operator/pkg/version"
3636

37-
goverion "github.com/hashicorp/go-version"
37+
"github.com/coreos/go-semver/semver"
3838
)
3939

4040
const (
@@ -160,21 +160,15 @@ func getReplicationGroupSeeds(name string, members int) string {
160160
}
161161

162162
func checkSupportGroupExitStateArgs(deployingVersion string) bool {
163-
ver, err := goverion.NewVersion(deployingVersion)
164-
if err != nil {
165-
return false
166-
}
163+
ver := semver.New(deployingVersion)
167164

168-
minVer, err := goverion.NewVersion(minMysqlVersionWithGroupExitStateArgs)
169-
if err != nil {
170-
return false
171-
}
165+
minVer := semver.New(minMysqlVersionWithGroupExitStateArgs)
172166

173-
if ver.GreaterThan(minVer) || ver.Equal(minVer) {
174-
return true
167+
if ver.LessThan(*minVer) {
168+
return false
175169
}
176170

177-
return false
171+
return true
178172
}
179173

180174
// Builds the MySQL operator container for a cluster.

0 commit comments

Comments
 (0)