maintner/maintnerd/maintapi: assign, not append, to empty slice

Assign the first element to an empty slice, rather than appending it.
There is no behavior change. The goal of this CL is to improve code
readability only.

After this change, it should be easier for the reader to see what
the slice content will be, without having to verify that earlier code
has not assigned anything to that slice.

Change-Id: I2aaeaafafbdf206f57b0f85b42ccfa726e72ca8c
Reviewed-on: https://go-review.googlesource.com/c/155461
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
Dmitri Shuralyov 2018-12-19 16:43:20 -05:00
Родитель 07f3a29356
Коммит b67de002b3
1 изменённых файлов: 3 добавлений и 3 удалений

Просмотреть файл

@ -189,9 +189,9 @@ func (s apiService) GoFindTryWork(ctx context.Context, req *apipb.GoFindTryWorkR
work.Commit = ci.CurrentRevision
}
if work.Project != "go" {
// Trybot on a subrepo. Append master and the supported releases.
work.GoBranch = append(work.GoBranch, "master")
work.GoCommit = append(work.GoCommit, goProj.Ref("refs/heads/master").String())
// Trybot on a subrepo. Set the Go fields to master and the supported releases.
work.GoBranch = []string{"master"}
work.GoCommit = []string{goProj.Ref("refs/heads/master").String()}
for _, r := range supportedReleases {
work.GoBranch = append(work.GoBranch, r.BranchName)
work.GoCommit = append(work.GoCommit, r.BranchCommit)