diff options
author | Robin Jarry <robin@jarry.cc> | 2022-08-22 20:23:16 +0200 |
---|---|---|
committer | Robin Jarry <robin@jarry.cc> | 2022-08-24 17:00:39 +0200 |
commit | 8f8dee83035d30e4b82c370489ceabec687eb6ad (patch) | |
tree | 66de712f1886513d28e2dbb870a13db5c3ebb1b3 /aerc.go | |
parent | 3ba8a3b7502491e3c657f8665415e4425279c66d (diff) | |
download | aerc-8f8dee83035d30e4b82c370489ceabec687eb6ad.tar.gz |
aerc: fix build when GOFLAGS contains spaces
Due to multiple levels of nested quoting, it is not possible to escape
spaces and/or quotes from GOFLAGS and pass the value to go build
-ldflags to set a compile time variable.
Encode main.Flags in base64 and decode it when reading it.
Fixes: d7e6dc3649ea ("aerc: add build info to version string")
Signed-off-by: Robin Jarry <robin@jarry.cc>
Acked-by: Moritz Poldrack <moritz@poldrack.dev>
Diffstat (limited to 'aerc.go')
-rw-r--r-- | aerc.go | 4 |
1 files changed, 3 insertions, 1 deletions
@@ -2,6 +2,7 @@ package main import ( "bytes" + "encoding/base64" "errors" "fmt" "os" @@ -95,7 +96,8 @@ var Flags string func buildInfo() string { info := Version - if strings.Contains(Flags, "notmuch") { + flags, _ := base64.StdEncoding.DecodeString(Flags) + if strings.Contains(string(flags), "notmuch") { info += " +notmuch" } info += fmt.Sprintf(" (%s %s %s)", |