mirror of
https://github.com/octoleo/restic.git
synced 2024-11-25 14:17:42 +00:00
Remove timestamp from version
command
This enables reproducible builds, for details see https://reproducible-builds.org/docs/timestamps/
This commit is contained in:
parent
98237bf942
commit
166d1811a1
6
build.go
6
build.go
@ -12,7 +12,6 @@ import (
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
||||
var (
|
||||
@ -33,8 +32,6 @@ var config = struct {
|
||||
Tests: []string{"restic/...", "cmds/..."}, // tests to run
|
||||
}
|
||||
|
||||
const timeFormat = "2006-01-02 15:04:05"
|
||||
|
||||
// specialDir returns true if the file begins with a special character ('.' or '_').
|
||||
func specialDir(name string) bool {
|
||||
if name == "." {
|
||||
@ -392,8 +389,7 @@ func main() {
|
||||
output := filepath.Join(cwd, outputFilename)
|
||||
|
||||
version := getVersion()
|
||||
compileTime := time.Now().Format(timeFormat)
|
||||
constants := Constants{`main.compiledAt`: compileTime}
|
||||
constants := Constants{}
|
||||
if version != "" {
|
||||
constants["main.version"] = version
|
||||
}
|
||||
|
@ -15,8 +15,8 @@ The "version" command prints detailed information about the build environment
|
||||
and the version of this software.
|
||||
`,
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
fmt.Printf("restic %s\ncompiled at %s with %v on %v/%v\n",
|
||||
version, compiledAt, runtime.Version(), runtime.GOOS, runtime.GOARCH)
|
||||
fmt.Printf("restic %s\ncompiled with %v on %v/%v\n",
|
||||
version, runtime.Version(), runtime.GOOS, runtime.GOARCH)
|
||||
},
|
||||
}
|
||||
|
||||
|
@ -26,7 +26,6 @@ import (
|
||||
)
|
||||
|
||||
var version = "compiled manually"
|
||||
var compiledAt = "unknown time"
|
||||
|
||||
func parseEnvironment(cmd *cobra.Command, args []string) {
|
||||
repo := os.Getenv("RESTIC_REPOSITORY")
|
||||
|
Loading…
Reference in New Issue
Block a user