Skip to content

Commit

Permalink
Merge pull request #563 from restic/fix-build-script
Browse files Browse the repository at this point in the history
Invert go version test for ldflags
  • Loading branch information
fd0 committed Aug 4, 2016
2 parents d860ce0 + 68ec29e commit e4a9905
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions build.go
Original file line number Diff line number Diff line change
Expand Up @@ -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))
}
}

Expand Down

0 comments on commit e4a9905

Please sign in to comment.