From 68ec29e7ec0b17f42c8c6b38f44326d4edd65dd7 Mon Sep 17 00:00:00 2001 From: Alexander Neumann Date: Wed, 3 Aug 2016 20:58:59 +0200 Subject: [PATCH] Invert go version test for ldflags --- build.go | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/build.go b/build.go index 14d2ea5ac..9e9e595cd 100644 --- a/build.go +++ b/build.go @@ -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)) } }