diff --git a/src/cmd/go/note_test.go b/src/cmd/go/note_test.go index 13ccfc74c0..d198138d83 100644 --- a/src/cmd/go/note_test.go +++ b/src/cmd/go/note_test.go @@ -54,10 +54,14 @@ func TestNoteReading(t *testing.T) { // Test while forcing use of the gold linker, since in the past // we've had trouble reading the notes generated by gold. err := tg.doRun([]string{"build", "-ldflags", "-buildid=" + buildID + " -linkmode=external -extldflags=-fuse-ld=gold", "-o", tg.path("hello3.exe"), tg.path("hello.go")}) - if err != nil && (tg.grepCountBoth("invalid linker") > 0 || tg.grepCountBoth("gold") > 0) { - // It's not an error if gold isn't there. - t.Log("skipping gold test") - break + if err != nil { + if tg.grepCountBoth("(invalid linker|gold|cannot find 'ld')") > 0 { + // It's not an error if gold isn't there. gcc claims it "cannot find 'ld'" if + // ld.gold is missing, see issue #22340. + t.Log("skipping gold test") + break + } + t.Fatalf("building hello binary: %v", err) } id, err = buildid.ReadFile(tg.path("hello3.exe")) if err != nil {