Skip to content

Commit f11a689

Browse files
committed
Added a new variable BuildVersion, which will store the current release/build version of grimd, separated from the config file version.
1 parent c40dd3c commit f11a689

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

config.go

+9-6
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,11 @@ import (
1111
"github.com/BurntSushi/toml"
1212
)
1313

14-
// Version returns the version of grimd, this should be incremented every time the config changes so grimd presents a warning
15-
var Version = "1.0.2"
14+
// BuildVersion returns the build version of grimd, this should be incremented every new release
15+
var BuildVersion = "1.0.4"
16+
17+
// ConfigVersion returns the version of grimd, this should be incremented every time the config changes so grimd presents a warning
18+
var ConfigVersion = "1.0.2"
1619

1720
type config struct {
1821
Version string
@@ -125,14 +128,14 @@ func LoadConfig(path string) error {
125128
return fmt.Errorf("could not load config: %s", err)
126129
}
127130

128-
if Config.Version != Version {
131+
if Config.Version != ConfigVersion {
129132
if Config.Version == "" {
130133
Config.Version = "none"
131134
}
132135

133-
log.Printf("warning, grimd.toml is out of date!\nconfig v%s\ngrimd v%s\nplease update your config\n", Config.Version, Version)
136+
log.Printf("warning, grimd.toml is out of date!\nconfig v%s\ngrimd config v%s\ngrimd v%s\nplease update your config\n", Config.Version, ConfigVersion, BuildVersion)
134137
} else {
135-
log.Printf("grimd v%s\n", Version)
138+
log.Printf("grimd v%s\n", BuildVersion)
136139
}
137140

138141
return nil
@@ -145,7 +148,7 @@ func generateConfig(path string) error {
145148
}
146149
defer output.Close()
147150

148-
r := strings.NewReader(fmt.Sprintf(defaultConfig, Version))
151+
r := strings.NewReader(fmt.Sprintf(defaultConfig, ConfigVersion))
149152
if _, err := io.Copy(output, r); err != nil {
150153
return fmt.Errorf("could not copy default config: %s", err)
151154
}

0 commit comments

Comments
 (0)