Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

release: v1.9.1 #26

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
#Fer

<a name="v1.9.1"></a>
## [v1.9.1] - 2021-07-30
### Fixes
- fix panic when latestVersion is empty


<a name="v1.9.0"></a>
## [v1.9.0] - 2021-01-14
## [v1.9.0] - 2021-01-21
### New Features
- add installation command for gocognit

Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion config/version.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package config

// Version define version of fer
const Version = "v1.9.0"
const Version = "v1.9.1"
29 changes: 19 additions & 10 deletions console/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down Expand Up @@ -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) {
Expand Down