From 43f392302dd9c7cc7482fa8ffa6e4cb3fad6200b Mon Sep 17 00:00:00 2001 From: Austin Clements Date: Wed, 24 Jul 2024 14:13:53 -0400 Subject: [PATCH] sweet/cmd/sweet: fix benchmark error report CL 600235 added code to print the benchmark log tail on failure, but that code overwrote the error from the benchmark itself, causing the log print to print a useless (generally ) error. Fix this. Change-Id: I4cd6bfeb08108b66fc5450c9e64bb13ed9fc1628 Reviewed-on: https://go-review.googlesource.com/c/benchmarks/+/600795 Auto-Submit: Austin Clements Reviewed-by: Michael Knyszek LUCI-TryBot-Result: Go LUCI --- sweet/cmd/sweet/benchmark.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sweet/cmd/sweet/benchmark.go b/sweet/cmd/sweet/benchmark.go index f70cae9..23cd8f1 100644 --- a/sweet/cmd/sweet/benchmark.go +++ b/sweet/cmd/sweet/benchmark.go @@ -380,9 +380,9 @@ func (b *benchmark) execute(cfgs []*common.Config, r *runCfg) error { if err := b.harness.Run(cfgs[i], &setup); err != nil { debug.SetGCPercent(gogc) // Useful error messages are often in the log. Grab the end. - logTail, err := readFileTail(setup.Results) - if err != nil { - logTail = fmt.Sprintf("error reading log tail: %s", err) + logTail, tailErr := readFileTail(setup.Results) + if tailErr != nil { + logTail = fmt.Sprintf("error reading log tail: %s", tailErr) } setup.Results.Close() return fmt.Errorf("run benchmark %s for config %s: %v\nLog tail:\n%s", b.name, cfgs[i].Name, err, logTail)