From: Russ Cox Date: Mon, 12 Jun 2023 20:11:35 +0000 (-0400) Subject: cmd/link: fix log formats for log.Fatal calls X-Git-Tag: go1.21rc1~24 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=b0e1707f94b9c6254c8cb2987d7b5c0db2ec5f2e;p=gostls13.git cmd/link: fix log formats for log.Fatal calls link contains many calls to log.Fatal, but it uses the default log output format, which is configured for server programs, not command-line tools. Set it up for command-line tools instead. Changes errors like 2023/06/12 14:32:24 reference to undefined builtin "runtime.gcWriteBarrier" from package "internal/abi" to link: reference to undefined builtin "runtime.gcWriteBarrier" from package "internal/abi" Change-Id: I3565960408c03f2f499a7517ec18c01870eb166c Reviewed-on: https://go-review.googlesource.com/c/go/+/502698 Run-TryBot: Russ Cox TryBot-Result: Gopher Robot Reviewed-by: Cherry Mui --- diff --git a/src/cmd/link/internal/ld/main.go b/src/cmd/link/internal/ld/main.go index 093bb4365b..7743562909 100644 --- a/src/cmd/link/internal/ld/main.go +++ b/src/cmd/link/internal/ld/main.go @@ -110,6 +110,9 @@ var ( // Main is the main entry point for the linker code. func Main(arch *sys.Arch, theArch Arch) { + log.SetPrefix("link: ") + log.SetFlags(0) + thearch = theArch ctxt := linknew(arch) ctxt.Bso = bufio.NewWriter(os.Stdout)