From 142d30b2cb036289b27726cee726129087728a66 Mon Sep 17 00:00:00 2001 From: qmuntal Date: Mon, 6 Mar 2023 12:36:31 +0100 Subject: [PATCH] cmd/go: trim spaces in pkg-config ldflags output Fixes #58889 Updates #35262 Change-Id: I1d51aa03f445faaf4f4e9cc412d5499cad526663 Reviewed-on: https://go-review.googlesource.com/c/go/+/473616 Reviewed-by: Bryan Mills Run-TryBot: Quim Muntal Auto-Submit: Quim Muntal TryBot-Result: Gopher Robot Reviewed-by: Ian Lance Taylor --- src/cmd/go/internal/work/exec.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cmd/go/internal/work/exec.go b/src/cmd/go/internal/work/exec.go index a14127f260c..e72a15950e6 100644 --- a/src/cmd/go/internal/work/exec.go +++ b/src/cmd/go/internal/work/exec.go @@ -1634,7 +1634,7 @@ func (b *Builder) getPkgConfigFlags(p *load.Package) (cflags, ldflags []string, if len(out) > 0 { // We need to handle path with spaces so that C:/Program\ Files can pass // checkLinkerFlags. Use splitPkgConfigOutput here just like we treat cflags. - ldflags, err = splitPkgConfigOutput(out) + ldflags, err = splitPkgConfigOutput(bytes.TrimSpace(out)) if err != nil { return nil, nil, err }