summaryrefslogtreecommitdiffstats
path: root/pkg/updates
diff options
context:
space:
mode:
authorJesse Duffield <jessedduffield@gmail.com>2018-09-01 10:36:22 +1000
committerJesse Duffield <jessedduffield@gmail.com>2018-09-01 10:36:55 +1000
commit42500817e00eac293a3e2c4e9e818022d02c2b81 (patch)
treed4de34adc51368f2fdd43ff4a8d8fa141297918c /pkg/updates
parentd8aba3aeee2f7811c383305a5beb7253a748f02f (diff)
better error for nonbackwards compatible changes
Diffstat (limited to 'pkg/updates')
-rw-r--r--pkg/updates/updates.go16
1 files changed, 12 insertions, 4 deletions
diff --git a/pkg/updates/updates.go b/pkg/updates/updates.go
index 5f533e5a0..4ec374616 100644
--- a/pkg/updates/updates.go
+++ b/pkg/updates/updates.go
@@ -96,6 +96,7 @@ func (u *Updater) majorVersionDiffers(oldVersion, newVersion string) bool {
func (u *Updater) checkForNewUpdate() (string, error) {
u.Log.Info("Checking for an updated version")
+ currentVersion := u.Config.GetVersion()
if err := u.RecordLastUpdateCheck(); err != nil {
return "", err
}
@@ -104,15 +105,22 @@ func (u *Updater) checkForNewUpdate() (string, error) {
if err != nil {
return "", err
}
- u.Log.Info("Current version is " + u.Config.GetVersion())
+ u.Log.Info("Current version is " + currentVersion)
u.Log.Info("New version is " + newVersion)
- if newVersion == u.Config.GetVersion() {
+ if newVersion == currentVersion {
return "", errors.New(u.Tr.SLocalize("OnLatestVersionErr"))
}
- if u.majorVersionDiffers(u.Config.GetVersion(), newVersion) {
- return "", errors.New(u.Tr.SLocalize("MajorVersionErr"))
+ if u.majorVersionDiffers(currentVersion, newVersion) {
+ errMessage := u.Tr.TemplateLocalize(
+ "MajorVersionErr",
+ i18n.Teml{
+ "newVersion": newVersion,
+ "currentVersion": currentVersion,
+ },
+ )
+ return "", errors.New(errMessage)
}
rawUrl, err := u.getBinaryUrl(newVersion)