fix setting version in build script

This commit is contained in:
Michael Eischer 2024-07-08 19:30:17 +02:00
parent a0cac7fcd1
commit 00d9ce7bee
2 changed files with 4 additions and 4 deletions

View file

@ -303,7 +303,7 @@ func generateFiles() {
}
}
var versionPattern = `const version = ".*"`
var versionPattern = `var version = ".*"`
const versionCodeFile = "cmd/restic/global.go"
@ -313,7 +313,7 @@ func updateVersion() {
die("unable to write version to file: %v", err)
}
newVersion := fmt.Sprintf("const version = %q", opts.Version)
newVersion := fmt.Sprintf("var version = %q", opts.Version)
replace(versionCodeFile, versionPattern, newVersion)
if len(uncommittedChanges("VERSION")) > 0 || len(uncommittedChanges(versionCodeFile)) > 0 {
@ -328,7 +328,7 @@ func updateVersionDev() {
die("unable to write version to file: %v", err)
}
newVersion := fmt.Sprintf(`const version = "%s-dev (compiled manually)"`, opts.Version)
newVersion := fmt.Sprintf(`var version = "%s-dev (compiled manually)"`, opts.Version)
replace(versionCodeFile, versionPattern, newVersion)
msg("committing cmd/restic/global.go with dev version")