[oscar] all: go fix -waitgroup ./...

1 view
Skip to first unread message

Hyang-Ah Hana Kim (Gerrit)

unread,
Feb 26, 2026, 10:07:57 PM (20 hours ago) Feb 26
to goph...@pubsubhelper.golang.org, Hyang-Ah Hana Kim, golang-co...@googlegroups.com

Hyang-Ah Hana Kim has uploaded the change for review

Commit message

all: go fix -waitgroup ./...
Change-Id: Icc080210976ab08a8f6c3b73b9cab8c6ef667391

Change diff

diff --git a/internal/commentfix/fix_test.go b/internal/commentfix/fix_test.go
index a5cffea..2cf151d 100644
--- a/internal/commentfix/fix_test.go
+++ b/internal/commentfix/fix_test.go
@@ -326,23 +326,17 @@
f, project, db := newFixer(t)
var wg sync.WaitGroup

- wg.Add(1)
- go func() {
+ wg.Go(func() {
runFix(t, f, project, 20)
- wg.Done()
- }()
+ })

- wg.Add(1)
- go func() {
+ wg.Go(func() {
runActions(t, f)
- wg.Done()
- }()
+ })

- wg.Add(1)
- go func() {
+ wg.Go(func() {
runFix(t, f, project, 18)
- wg.Done()
- }()
+ })

wg.Wait()

diff --git a/internal/gcp/firestore/db_test.go b/internal/gcp/firestore/db_test.go
index d9fae12..2124c35 100644
--- a/internal/gcp/firestore/db_test.go
+++ b/internal/gcp/firestore/db_test.go
@@ -175,21 +175,17 @@

var wg sync.WaitGroup
for range 5 {
- wg.Add(1)
- go func() {
+ wg.Go(func() {
db.Lock(name)
time.Sleep(time.Millisecond)
db.Unlock(name)
- wg.Done()
- }()
+ })

- wg.Add(1)
- go func() {
+ wg.Go(func() {
db2.Lock(name)
time.Sleep(time.Millisecond)
db2.Unlock(name)
- wg.Done()
- }()
+ })
}

wg.Wait()
diff --git a/internal/goreviews/collect.go b/internal/goreviews/collect.go
index 1aa8b0d..23aaeea 100644
--- a/internal/goreviews/collect.go
+++ b/internal/goreviews/collect.go
@@ -29,11 +29,9 @@
chAccount := make(chan *gerrit.Change, 16)

var wg sync.WaitGroup
- wg.Add(1)
- go func() {
- defer wg.Done()
+ wg.Go(func() {
collectAccounts(client, accounts, chAccount)
- }()
+ })

// Collect account data first.
for _, project := range projects {
diff --git a/internal/reviews/collect.go b/internal/reviews/collect.go
index 4c08638..82ada1d 100644
--- a/internal/reviews/collect.go
+++ b/internal/reviews/collect.go
@@ -30,9 +30,7 @@
chOut := make(chan ChangePreds, count)

var wg sync.WaitGroup
- wg.Add(1)
- go func() {
- defer wg.Done()
+ wg.Go(func() {
defer close(chIn)
for change := range it {
select {
@@ -41,7 +39,7 @@
return
}
}
- }()
+ })

wg.Add(count)
for range count {
diff --git a/internal/storage/test.go b/internal/storage/test.go
index 8e9ddd8..ad62bc6 100644
--- a/internal/storage/test.go
+++ b/internal/storage/test.go
@@ -139,13 +139,11 @@
db.Lock("abc")
c := make(chan struct{})
var wg sync.WaitGroup
- wg.Add(1)
- go func() {
+ wg.Go(func() {
db.Lock("abc")
close(c)
db.Unlock("abc")
- wg.Done()
- }()
+ })

// The db.Lock in the goroutine should block, since the lock is already held.
select {

Change information

Files:
  • M internal/commentfix/fix_test.go
  • M internal/gcp/firestore/db_test.go
  • M internal/goreviews/collect.go
  • M internal/reviews/collect.go
  • M internal/storage/test.go
Change size: S
Delta: 5 files changed, 16 insertions(+), 32 deletions(-)
Open in Gerrit

Related details

Attention set is empty
Submit Requirements:
  • requirement is not satisfiedCode-Review
  • requirement satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
  • requirement is not satisfiedTryBots-Pass
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: newchange
Gerrit-Project: oscar
Gerrit-Branch: master
Gerrit-Change-Id: Icc080210976ab08a8f6c3b73b9cab8c6ef667391
Gerrit-Change-Number: 749651
Gerrit-PatchSet: 1
Gerrit-Owner: Hyang-Ah Hana Kim <hya...@gmail.com>
Gerrit-Reviewer: Hyang-Ah Hana Kim <hya...@gmail.com>
unsatisfied_requirement
satisfied_requirement
open
diffy

Ian Lance Taylor (Gerrit)

unread,
4:22 PM (2 hours ago) 4:22 PM
to Hyang-Ah Hana Kim, goph...@pubsubhelper.golang.org, Ian Lance Taylor, Go LUCI, golang-co...@googlegroups.com
Attention needed from Hyang-Ah Hana Kim

Ian Lance Taylor voted and added 1 comment

Votes added by Ian Lance Taylor

Code-Review+2

1 comment

File internal/reviews/collect.go
Line 46, Patchset 1 (Latest): go func() {
Ian Lance Taylor . resolved

We could use wg.Go here too. I guess the analyzer doesn't see it because it's not wg.Add(1).

Open in Gerrit

Related details

Attention is currently required from:
  • Hyang-Ah Hana Kim
Submit Requirements:
  • requirement satisfiedCode-Review
  • requirement satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
  • requirement satisfiedTryBots-Pass
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: oscar
Gerrit-Branch: master
Gerrit-Change-Id: Icc080210976ab08a8f6c3b73b9cab8c6ef667391
Gerrit-Change-Number: 749651
Gerrit-PatchSet: 1
Gerrit-Owner: Hyang-Ah Hana Kim <hya...@gmail.com>
Gerrit-Reviewer: Hyang-Ah Hana Kim <hya...@gmail.com>
Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
Gerrit-Attention: Hyang-Ah Hana Kim <hya...@gmail.com>
Gerrit-Comment-Date: Fri, 27 Feb 2026 21:22:47 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
satisfied_requirement
unsatisfied_requirement
open
diffy

Nicholas Husin (Gerrit)

unread,
4:40 PM (2 hours ago) 4:40 PM
to Hyang-Ah Hana Kim, goph...@pubsubhelper.golang.org, Ian Lance Taylor, Go LUCI, golang-co...@googlegroups.com
Attention needed from Hyang-Ah Hana Kim

Nicholas Husin voted Code-Review+1

Code-Review+1
Open in Gerrit

Related details

Attention is currently required from:
  • Hyang-Ah Hana Kim
Submit Requirements:
    • requirement satisfiedCode-Review
    • requirement satisfiedNo-Unresolved-Comments
    • requirement satisfiedReview-Enforcement
    • requirement satisfiedTryBots-Pass
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: oscar
    Gerrit-Branch: master
    Gerrit-Change-Id: Icc080210976ab08a8f6c3b73b9cab8c6ef667391
    Gerrit-Change-Number: 749651
    Gerrit-PatchSet: 1
    Gerrit-Owner: Hyang-Ah Hana Kim <hya...@gmail.com>
    Gerrit-Reviewer: Hyang-Ah Hana Kim <hya...@gmail.com>
    Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
    Gerrit-Reviewer: Nicholas Husin <hu...@google.com>
    Gerrit-Attention: Hyang-Ah Hana Kim <hya...@gmail.com>
    Gerrit-Comment-Date: Fri, 27 Feb 2026 21:40:16 +0000
    Gerrit-HasComments: No
    Gerrit-Has-Labels: Yes
    satisfied_requirement
    open
    diffy

    Hyang-Ah Hana Kim (Gerrit)

    unread,
    4:44 PM (2 hours ago) 4:44 PM
    to Hyang-Ah Hana Kim, goph...@pubsubhelper.golang.org, golang-...@googlegroups.com, Nicholas Husin, Ian Lance Taylor, Go LUCI, golang-co...@googlegroups.com

    Hyang-Ah Hana Kim submitted the change

    Change information

    Commit message:
    all: go fix -waitgroup ./...
    Change-Id: Icc080210976ab08a8f6c3b73b9cab8c6ef667391
    Reviewed-by: Ian Lance Taylor <ia...@golang.org>
    Reviewed-by: Nicholas Husin <hu...@google.com>
    Files:
    • M internal/commentfix/fix_test.go
    • M internal/gcp/firestore/db_test.go
    • M internal/goreviews/collect.go
    • M internal/reviews/collect.go
    • M internal/storage/test.go
    Change size: S
    Delta: 5 files changed, 16 insertions(+), 32 deletions(-)
    Branch: refs/heads/master
    Submit Requirements:
    • requirement satisfiedCode-Review: +2 by Ian Lance Taylor, +1 by Nicholas Husin
    • requirement satisfiedTryBots-Pass: LUCI-TryBot-Result+1 by Go LUCI
    Open in Gerrit
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: merged
    Gerrit-Project: oscar
    Gerrit-Branch: master
    Gerrit-Change-Id: Icc080210976ab08a8f6c3b73b9cab8c6ef667391
    Gerrit-Change-Number: 749651
    Gerrit-PatchSet: 2
    open
    diffy
    satisfied_requirement
    Reply all
    Reply to author
    Forward
    0 new messages