Skip to content

Commit

Permalink
version check
Browse files Browse the repository at this point in the history
  • Loading branch information
fleshin committed Oct 4, 2023
1 parent 261d43a commit d8e2cb2
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ require github.com/theckman/yacspin v0.13.12
require (
github.com/Microsoft/go-winio v0.6.1 // indirect
github.com/emirpasic/gods v1.18.1 // indirect
github.com/hashicorp/go-version v1.6.0 // indirect
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect
github.com/kevinburke/ssh_config v1.2.0 // indirect
github.com/mitchellh/go-homedir v1.1.0 // indirect
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568/go.mod h1:xEzjJPgXI
github.com/gliderlabs/ssh v0.2.2/go.mod h1:U7qILu1NlMHj9FlMhZLlkCdDnU1DBEAqr0aevW3Awn0=
github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
github.com/google/go-cmp v0.5.6 h1:BKbKCqvP6I+rmFHt06ZmyQtvB8xAkWdhFyr0ZUNZcxQ=
github.com/hashicorp/go-version v1.6.0 h1:feTTfFNnjP967rlCxM/I9g701jU+RN74YKx2mOkIeek=
github.com/hashicorp/go-version v1.6.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA=
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 h1:BQSFePA1RWJOlocH6Fxy8MmwDt+yVQYULKfN0RoTN8A=
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99/go.mod h1:1lJo3i6rXxKeerYnT8Nvf0QmHCRC1n8sfWVwXF2Frvo=
github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI=
Expand Down
8 changes: 7 additions & 1 deletion run/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"os/exec"
"time"

ver "github.com/hashicorp/go-version"
"github.com/theckman/yacspin"
"gopkg.in/yaml.v3"
)
Expand Down Expand Up @@ -130,7 +131,12 @@ func LoadSetFromDir(dir string) (*Set, error) {
return &s, err
}

func (ds *Set) checkVersion() bool {
func (s *Set) checkVersion() bool {
runVer, _ := ver.NewVersion(GetVer())
fileVer, _ := ver.NewVersion(s.Ver)
if runVer.LessThan(fileVer) {
fmt.Printf("warining: This program version %s is trying to read from more rencent version files %s\n", runVer, fileVer)
}
return true
}

Expand Down

0 comments on commit d8e2cb2

Please sign in to comment.