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

Commit 0b8208e

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 0b8208e

File tree

1 file changed

+6
-13
lines changed

1 file changed

+6
-13
lines changed

pkg/resources/statefulsets/statefulset.go

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ package statefulsets
1616

1717
import (
1818
"fmt"
19+
"github.com/coreos/go-semver/semver"
1920
"os"
2021
"strconv"
2122
"strings"
@@ -33,8 +34,6 @@ import (
3334
operatoropts "github.com/oracle/mysql-operator/pkg/options/operator"
3435
"github.com/oracle/mysql-operator/pkg/resources/secrets"
3536
"github.com/oracle/mysql-operator/pkg/version"
36-
37-
goverion "github.com/hashicorp/go-version"
3837
)
3938

4039
const (
@@ -160,21 +159,15 @@ func getReplicationGroupSeeds(name string, members int) string {
160159
}
161160

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

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

173-
if ver.GreaterThan(minVer) || ver.Equal(minVer) {
174-
return true
166+
if ver.LessThan(*minVer) {
167+
return false
175168
}
176169

177-
return false
170+
return true
178171
}
179172

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

0 commit comments

Comments
 (0)