From 00d9ce7bee2cce668e222abfaa1de9d60015194c Mon Sep 17 00:00:00 2001 From: Michael Eischer Date: Mon, 8 Jul 2024 19:30:17 +0200 Subject: [PATCH] fix setting version in build script --- cmd/restic/global.go | 2 +- helpers/prepare-release/main.go | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/cmd/restic/global.go b/cmd/restic/global.go index ff4fda5b6..cd6a683bf 100644 --- a/cmd/restic/global.go +++ b/cmd/restic/global.go @@ -43,7 +43,7 @@ import ( "golang.org/x/term" ) -const version = "0.16.5-dev (compiled manually)" +var version = "0.16.5-dev (compiled manually)" // TimeFormat is the format used for all timestamps printed by restic. const TimeFormat = "2006-01-02 15:04:05" diff --git a/helpers/prepare-release/main.go b/helpers/prepare-release/main.go index f01fe8a2f..ba3de38a5 100644 --- a/helpers/prepare-release/main.go +++ b/helpers/prepare-release/main.go @@ -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")