mirror of
https://github.com/restic/restic.git
synced 2025-12-14 13:42:16 +00:00
extract GlobalOptions into internal/global package
Rough steps: ``` mv cmd/restic/global* cmd/restic/secondary_repo* internal/global/ sed -i "s/package main/package global/" internal/global/*.go Rename "GlobalOptions" to "Options" in internal/global/ Replace everywhere " GlobalOptions" -> " global.Options" Replace everywhere "\*GlobalOptions" -> " *global.Options" Make SecondaryRepoOptions public Make create public Make version public ```
This commit is contained in:
@@ -308,9 +308,9 @@ func generateFiles() {
|
||||
}
|
||||
}
|
||||
|
||||
var versionPattern = `var version = ".*"`
|
||||
var versionPattern = `const Version = ".*"`
|
||||
|
||||
const versionCodeFile = "cmd/restic/global.go"
|
||||
const versionCodeFile = "internal/global/global.go"
|
||||
|
||||
func updateVersion() {
|
||||
err := os.WriteFile("VERSION", []byte(opts.Version+"\n"), 0644)
|
||||
@@ -318,7 +318,7 @@ func updateVersion() {
|
||||
die("unable to write version to file: %v", err)
|
||||
}
|
||||
|
||||
newVersion := fmt.Sprintf("var version = %q", opts.Version)
|
||||
newVersion := fmt.Sprintf("const Version = %q", opts.Version)
|
||||
replace(versionCodeFile, versionPattern, newVersion)
|
||||
|
||||
if len(uncommittedChanges("VERSION")) > 0 || len(uncommittedChanges(versionCodeFile)) > 0 {
|
||||
|
||||
Reference in New Issue
Block a user