mirror of
https://github.com/go-gitea/gitea.git
synced 2026-08-26 13:29:52 +09:00
refactor(waitgroup): replace Add/Done goroutines with WaitGroup.Go (#37764)
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: wxiaoguang <2114189+wxiaoguang@users.noreply.github.com>
This commit is contained in:
co-authored by
copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
wxiaoguang
parent
e60ca35d52
commit
912afcaa51
@@ -171,9 +171,8 @@ func testAPICreateIssueParallel(t *testing.T) {
|
||||
|
||||
var wg sync.WaitGroup
|
||||
for i := range 10 {
|
||||
wg.Add(1)
|
||||
go func(parentT *testing.T, i int) {
|
||||
parentT.Run(fmt.Sprintf("ParallelCreateIssue_%d", i), func(t *testing.T) {
|
||||
wg.Go(func() {
|
||||
t.Run(fmt.Sprintf("ParallelCreateIssue_%d", i), func(t *testing.T) {
|
||||
newTitle := title + strconv.Itoa(i)
|
||||
newBody := body + strconv.Itoa(i)
|
||||
req := NewRequestWithJSON(t, "POST", urlStr, &api.CreateIssueOption{
|
||||
@@ -192,10 +191,8 @@ func testAPICreateIssueParallel(t *testing.T) {
|
||||
Content: newBody,
|
||||
Title: newTitle,
|
||||
})
|
||||
|
||||
wg.Done()
|
||||
})
|
||||
}(t, i)
|
||||
})
|
||||
}
|
||||
wg.Wait()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user