diff --git a/CHANGELOG.md b/CHANGELOG.md
index b47d3d4..3e951a4 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,7 +1,13 @@
#Fer
+
+## [v1.9.1] - 2021-07-30
+### Fixes
+- fix panic when latestVersion is empty
+
+
-## [v1.9.0] - 2021-01-14
+## [v1.9.0] - 2021-01-21
### New Features
- add installation command for gocognit
@@ -135,7 +141,8 @@
- db migrationfile generator ([#3](https://github.com/kumparan/fer/issues/3))
-[Unreleased]: https://github.com/kumparan/fer/compare/v1.9.0...HEAD
+[Unreleased]: https://github.com/kumparan/fer/compare/v1.9.1...HEAD
+[v1.9.1]: https://github.com/kumparan/fer/compare/v1.9.0...v1.9.1
[v1.9.0]: https://github.com/kumparan/fer/compare/v1.8.1...v1.9.0
[v1.8.1]: https://github.com/kumparan/fer/compare/v1.8.0...v1.8.1
[v1.8.0]: https://github.com/kumparan/fer/compare/v1.7.2...v1.8.0
diff --git a/config/version.go b/config/version.go
index 8710c8c..ffa6f7e 100644
--- a/config/version.go
+++ b/config/version.go
@@ -1,4 +1,4 @@
package config
// Version define version of fer
-const Version = "v1.9.0"
+const Version = "v1.9.1"
diff --git a/console/version.go b/console/version.go
index 7d895db..35aeeba 100644
--- a/console/version.go
+++ b/console/version.go
@@ -3,13 +3,14 @@ package console
import (
"encoding/json"
"fmt"
+ "io/ioutil"
+ "net/http"
+ "path/filepath"
+
"github.com/blang/semver"
"github.com/kumparan/fer/cache"
"github.com/kumparan/fer/config"
"github.com/spf13/cobra"
- "io/ioutil"
- "net/http"
- "path/filepath"
)
const (
@@ -81,18 +82,26 @@ func getFerLatestVersionCached() (ver string, err error) {
}
func checkVersion() {
- latestVer, err := getFerLatestVersionCached()
- if err != nil {
- PrintWarn("Error getting latest version: %s\n", err.Error())
- }
- currentVersion, err := semver.Make(config.Version[1:])
+ currentVersion, err := semver.ParseTolerant(config.Version)
if err != nil {
PrintWarn("Error parsing current version: %s\n", err.Error())
return
}
- latestVersion, err := semver.Make(latestVer[1:])
+
+ latestVer, err := getFerLatestVersionCached()
if err != nil {
- PrintWarn("Error parsing latest version: %s\n", err.Error())
+ PrintWarn("Error getting latest version: %s\n", err.Error())
+ }
+
+ var latestVersion semver.Version
+ switch latestVer {
+ case "":
+ PrintWarn("Error parsing latest version empty\n")
+ default:
+ latestVersion, err = semver.ParseTolerant(latestVer)
+ if err != nil {
+ PrintWarn("Error parsing latest version: %s\n", err.Error())
+ }
}
if currentVersion.LT(latestVersion) {