Skip to content

Commit

Permalink
Reduce number of semver libraries
Browse files Browse the repository at this point in the history
  • Loading branch information
twpayne committed Feb 2, 2019
1 parent d307169 commit b477972
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 8 deletions.
10 changes: 5 additions & 5 deletions cmd/doctor.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"regexp"
"strings"

"github.com/blang/semver"
"github.com/coreos/go-semver/semver"
"github.com/spf13/cobra"
vfs "github.com/twpayne/go-vfs"
)
Expand Down Expand Up @@ -213,12 +213,12 @@ func (c *doctorBinaryCheck) Check() (bool, error) {
if m == nil {
return false, fmt.Errorf("%s: could not extract version from %q", c.path, output)
}
version, err := semver.Parse(string(m[1]))
version, err := semver.NewVersion(string(m[1]))
if err != nil {
return false, err
}
c.version = &version
if c.minVersion != nil && c.version.LT(*c.minVersion) {
c.version = version
if c.minVersion != nil && c.version.LessThan(*c.minVersion) {
return false, nil
}
}
Expand All @@ -241,7 +241,7 @@ func (c *doctorBinaryCheck) Result() string {
s := fmt.Sprintf("%s (%s", c.path, c.name)
if c.version != nil {
s += ", version " + c.version.String()
if c.minVersion != nil && c.version.LT(*c.minVersion) {
if c.minVersion != nil && c.version.LessThan(*c.minVersion) {
s += ", want version >=" + c.minVersion.String()
}
}
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ require (
github.com/Masterminds/semver v1.4.2 // indirect
github.com/Masterminds/sprig v2.17.1+incompatible
github.com/aokoli/goutils v1.1.0 // indirect
github.com/blang/semver v3.5.1+incompatible
github.com/coreos/go-semver v0.2.0
github.com/d4l3k/messagediff v1.2.1
github.com/danieljoos/wincred v1.0.1 // indirect
github.com/godbus/dbus v4.1.0+incompatible // indirect
Expand Down
3 changes: 1 addition & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,9 @@ github.com/Masterminds/sprig v2.17.1+incompatible/go.mod h1:y6hNFY5UBTIWBxnzTeuN
github.com/aokoli/goutils v1.1.0 h1:jy4ghdcYvs5EIoGssZNslIASX5m+KNMfyyKvRQ0TEVE=
github.com/aokoli/goutils v1.1.0/go.mod h1:SijmP0QR8LtwsmDs8Yii5Z/S4trXFGFC2oO5g9DP+DQ=
github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8=
github.com/blang/semver v3.5.1+incompatible h1:cQNTCjp13qL8KC3Nbxr/y2Bqb63oX6wdnnjpJbkM4JQ=
github.com/blang/semver v3.5.1+incompatible/go.mod h1:kRBLl5iJ+tD4TcOOxsy/0fnwebNt5EWlYSAyrTnjyyk=
github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE=
github.com/coreos/go-etcd v2.0.0+incompatible/go.mod h1:Jez6KQU2B/sWsbdaef3ED8NzMklzPG4d5KIOhIy30Tk=
github.com/coreos/go-semver v0.2.0 h1:3Jm3tLmsgAYcjC+4Up7hJrFBPr+n7rAqYeSw/SZazuY=
github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk=
github.com/d4l3k/messagediff v1.2.1 h1:ZcAIMYsUg0EAp9X+tt8/enBE/Q8Yd5kzPynLyKptt9U=
github.com/d4l3k/messagediff v1.2.1/go.mod h1:Oozbb1TVXFac9FtSIxHBMnBCq2qeH/2KkEQxENCrlLo=
Expand Down

0 comments on commit b477972

Please sign in to comment.