From 2f507985dc24d198b763e5568ebe5c04d788894f Mon Sep 17 00:00:00 2001 From: David Chase Date: Fri, 27 Sep 2024 19:15:03 -0400 Subject: [PATCH] cmd/go: adjust test with tricky ld flags to not run on Darwin normally this would not run on darwin anyway, but if there happens to be a "pkg-config" binary, then it will. Darwin's clang/linker does not have this flag. Change-Id: I61929cf193c95b420441187beb8b237fa1037807 Reviewed-on: https://go-review.googlesource.com/c/go/+/616376 LUCI-TryBot-Result: Go LUCI Reviewed-by: Sam Thanawalla Reviewed-by: Michael Matloob --- src/cmd/go/go_test.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/cmd/go/go_test.go b/src/cmd/go/go_test.go index b99656d3ce9665..c24ab2a794742f 100644 --- a/src/cmd/go/go_test.go +++ b/src/cmd/go/go_test.go @@ -1505,13 +1505,16 @@ func main() { tg.setenv("PKG_CONFIG_PATH", tg.path(".")) tg.run("run", tg.path("foo.go")) - // test for ldflags - tg.tempFile("bar.pc", ` + if runtime.GOOS != "darwin" { // darwin doesn't like these ldflags + // test for ldflags + tg.tempFile("bar.pc", ` Name: bar Description: The bar library Version: 1.0.0 Libs: -Wl,-rpath=/path\ with\ spaces/bin `) + } + tg.tempFile("bar.go", `package main /* #cgo pkg-config: bar