2
2
mirror of https://github.com/octoleo/restic.git synced 2024-11-04 12:34:13 +00:00

Merge pull request #563 from restic/fix-build-script

Invert go version test for ldflags
This commit is contained in:
Alexander Neumann 2016-08-04 19:37:30 +02:00
commit e4a9905d6f

View File

@ -264,14 +264,13 @@ type Constants map[string]string
func (cs Constants) LDFlags() string {
l := make([]string, 0, len(cs))
v := runtime.Version()
if strings.HasPrefix(v, "devel") || strings.HasPrefix(v, "go1.5") || strings.HasPrefix(v, "go1.6") || strings.HasPrefix(v, "go1.7") {
if runtime.Version() < "go1.5" {
for k, v := range cs {
l = append(l, fmt.Sprintf(`-X "%s=%s"`, k, v))
l = append(l, fmt.Sprintf(`-X %q %q`, k, v))
}
} else {
for k, v := range cs {
l = append(l, fmt.Sprintf(`-X %q %q`, k, v))
l = append(l, fmt.Sprintf(`-X "%s=%s"`, k, v))
}
}