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 <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
diff --git a/cmd/coordinator/internal/legacydash/ui.go b/cmd/coordinator/internal/legacydash/ui.go
index f5412b6..3c68cc2 100644
--- a/cmd/coordinator/internal/legacydash/ui.go
+++ b/cmd/coordinator/internal/legacydash/ui.go
@@ -214,7 +214,9 @@
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.