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 <bcmills@google.com>
Run-TryBot: Quim Muntal <quimmuntal@gmail.com>
Auto-Submit: Quim Muntal <quimmuntal@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
This commit is contained in:
qmuntal 2023-03-06 12:36:31 +01:00 committed by Gopher Robot
parent b94dc384ca
commit 142d30b2cb

View file

@ -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
}