From 6a613cbe61dc59f019f91c95bdcc4c4210a48b7c Mon Sep 17 00:00:00 2001 From: Dmitri Shuralyov Date: Fri, 22 Mar 2024 18:43:15 -0400 Subject: [PATCH] cmd/coordinator/internal/legacydash: don't clobber ResultData slice during append Back when there was only one source of result data (Datastore), the CommitInfo.ResultData field was only assigned to. By now, it's also sometimes appended to. Remove extra capacity in the shared slice so that appending results to the same x/ repo commit (i.e., a total of three times: for the main branch, and two release branches) is fine. This happened not to come up during local development, at least not until Datastore permissions were setup to permit its use, but it is easy to see on build.golang.org. For golang/go#65913. Change-Id: Id19ddf389f8d7ac4d69f2ac8477443005b9671ef Reviewed-on: https://go-review.googlesource.com/c/build/+/574557 Reviewed-by: Michael Knyszek LUCI-TryBot-Result: Go LUCI Reviewed-by: Dmitri Shuralyov Auto-Submit: Dmitri Shuralyov --- cmd/coordinator/internal/legacydash/ui.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cmd/coordinator/internal/legacydash/ui.go b/cmd/coordinator/internal/legacydash/ui.go index f5412b639f..3c68cc2610 100644 --- a/cmd/coordinator/internal/legacydash/ui.go +++ b/cmd/coordinator/internal/legacydash/ui.go @@ -214,7 +214,9 @@ func (tb *uiTemplateDataBuilder) newCommitInfo(dsCommits map[string]*Commit, rep Branch: branch, } if dsc, ok := dsCommits[dc.Commit]; ok { - ci.ResultData = dsc.ResultData + // Remove extra dsc.ResultData capacity to make it + // okay to append additional data to ci.ResultData. + ci.ResultData = dsc.ResultData[:len(dsc.ResultData):len(dsc.ResultData)] } // For non-go repos, add the rows for the Go commits that were // at HEAD overlapping in time with dc.Commit.