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>
This commit is contained in:
Russ Cox 2023-06-12 16:11:35 -04:00
parent 0b5a4afec9
commit b0e1707f94
1 changed files with 3 additions and 0 deletions

View File

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