From 46f4ffbc5cb57169ae9ae1510e397c4b69e28b58 Mon Sep 17 00:00:00 2001 From: "mehdi.cheracher@gmail.com" Date: Thu, 2 Apr 2020 12:17:41 +0100 Subject: [PATCH] Add explicit version numbers. The release of the new version of egor, would be by adding a new commit upgrading the version to a new version number. --- config/config.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/config/config.go b/config/config.go index 64730b0..2d875d8 100644 --- a/config/config.go +++ b/config/config.go @@ -13,6 +13,8 @@ import ( "gopkg.in/yaml.v2" ) +const LatestVersion = "0.2.0" + // The configuration of the CLI type Config struct { Server struct { @@ -52,7 +54,7 @@ func createDefaultConfiguration() *Config { }{ Default: "cpp", }, - Version: "0.1.0", + Version: LatestVersion, ConfigFileName: "egor-meta.json", CppLibraryLocation: path.Join(homeDir, "include"), } @@ -89,6 +91,12 @@ func LoadConfiguration(location string) (*Config, error) { if err != nil { return nil, err } + // Check if the current version (maybe the user already has a configuration file) + // is an older version. and update accordingly + if config.Version < LatestVersion { + config.Version = LatestVersion + _ = SaveConfiguration(&config) + } return &config, nil }