golang / go

The Go programming language
https://go.dev
BSD 3-Clause "New" or "Revised" License
123.55k stars 17.61k forks source link

x/build/devapp: duplicate CL lines on /release page #26113

Closed bradfitz closed 6 years ago

bradfitz commented 6 years ago

I just noticed duplicate lines for an open CL:

dup

bradfitz commented 6 years ago

/cc @dmitshur

dmitshur commented 6 years ago

This seems to happen when the CL description mentions the same issue more than once. For example, here's a current occurrence of this bug:

image

Here's the commit message of CL 26650 mentioning that issue twice:

image

Seems like a straightforward bug to fix; I'll use it as a warm up.

dmitshur commented 6 years ago

maintner.GerritCL has a field GitHubIssueRefs of type []GitHubIssueRef. Currently, if the CL description mentions the same issue more than once, there will be multiple identical GitHubIssueRef entries in that slice. E.g.:

corpus, err := godata.Get(context.Background())
if err != nil {
    return err
}
proj := corpus.Gerrit().Project("go.googlesource.com", "sys")
cl := proj.CL(26650)
for _, ref := range cl.GitHubIssueRefs {
    fmt.Println(ref.Repo.ID(), ref.Number)
}

// Output:
// golang/go 14873
// golang/go 14873

While it's possible to deduplicate these lines in devapp-only, I suspect a better fix is to deduplicate them in maintner.

(At least at this time, GitHubIssueRef doesn't track anything other than repo and issue number, so multiple entries carry very little information. If we ever want to change that to also have a "character position" or something to make multiple entries non-unique, then we can stop deduplicating.)

gopherbot commented 6 years ago

Change https://golang.org/cl/128119 mentions this issue: maintner: deduplicate issue references in parseGithubRefs

dmitshur commented 6 years ago

I've deployed the new version and confirmed that the bug is fixed in production.

Before

image

After

image