aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2023-06-12 16:11:35 -0400
committerRuss Cox <rsc@golang.org>2023-06-13 03:06:54 +0000
commitb0e1707f94b9c6254c8cb2987d7b5c0db2ec5f2e (patch)
treecb6334636257652686885ba8bce25a0beaf35e72
parent0b5a4afec9df67157891732e5ca660eaf1efab34 (diff)
downloadgo-b0e1707f94b9c6254c8cb2987d7b5c0db2ec5f2e.tar.gz
go-b0e1707f94b9c6254c8cb2987d7b5c0db2ec5f2e.zip
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 <rsc@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Cherry Mui <cherryyz@google.com>
-rw-r--r--src/cmd/link/internal/ld/main.go3
1 files changed, 3 insertions, 0 deletions
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)