Skip to content

refactor(waitgroup): replace Add/Done goroutines with WaitGroup.Go#37764

Merged
wxiaoguang merged 1 commit into
mainfrom
copilot/refactor-waitgroup-patterns
May 18, 2026
Merged

refactor(waitgroup): replace Add/Done goroutines with WaitGroup.Go#37764
wxiaoguang merged 1 commit into
mainfrom
copilot/refactor-waitgroup-patterns

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 18, 2026

This refactors legacy sync.WaitGroup goroutine launch sites to the modern WaitGroup.Go API. It removes manual waitgroup bookkeeping in eligible paths without changing concurrency semantics.

  • Scope

    • Update eligible sync.WaitGroup goroutine launches in modules/ssh and the affected Go test files under modules/templates and tests/integration.
  • What changed

    • Replace manual wg.Add(1) + go func() { ...; wg.Done() }() patterns with wg.Go(func() { ... }).
    • Keep existing closure behavior intact at each call site rather than changing surrounding control flow.
    • Leave non-eligible waitgroup usage unchanged.
  • Result

    • Less error-prone goroutine coordination.
    • Shorter, more idiomatic concurrency code.
    • Easier future cleanup of remaining waitgroup usages.
  • Example

    var wg sync.WaitGroup
    
    wg.Go(func() {
    	doWork()
    })
    
    wg.Wait()

@wxiaoguang wxiaoguang marked this pull request as ready for review May 18, 2026 13:10
@GiteaBot GiteaBot added the lgtm/need 1 This PR needs approval from one additional maintainer to be merged. label May 18, 2026
@GiteaBot GiteaBot added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels May 18, 2026
@wxiaoguang wxiaoguang merged commit 912afca into main May 18, 2026
31 checks passed
@wxiaoguang wxiaoguang deleted the copilot/refactor-waitgroup-patterns branch May 18, 2026 15:22
@GiteaBot GiteaBot added this to the 1.27.0 milestone May 18, 2026
silverwind added a commit to silverwind/gitea that referenced this pull request May 19, 2026
* origin/main: (104 commits)
  fix(deps): update module github.com/go-git/go-git/v5 to v5.19.1 [security] (go-gitea#37786)
  fix(pull): handle empty pull request files view to allow reviews (go-gitea#37783)
  fix(markup): make RenderString never fail (go-gitea#37779)
  fix(markup): wrap indented code blocks for the code-copy button (go-gitea#37748)
  fix(permissions): Fix reading permission (go-gitea#37769)
  fix: add natural sort to sortTreeViewNodes (go-gitea#37772)
  fix: package creation unique conflict (go-gitea#37774)
  fix(deps): update npm dependencies (go-gitea#37768)
  fix(deps): update module gitlab.com/gitlab-org/api/client-go/v2 to v2.26.0 (go-gitea#37771)
  ci: split giteabot workflow (go-gitea#37770)
  [skip ci] Updated translations via Crowdin
  fix: Unify public-only token filtering in API queries and repo access checks (go-gitea#37118)
  fix(deps): update module google.golang.org/grpc to v1.81.1 (go-gitea#37762)
  chore: make DefaultTitleSource default to auto to match GitHub (go-gitea#37767)
  ci: fix cache-related issues (go-gitea#37761)
  chore: fix tests (go-gitea#37760)
  refactor(waitgroup): replace Add/Done goroutines with WaitGroup.Go (go-gitea#37764)
  fix(deps): update go dependencies (go-gitea#37752)
  chore(deps): update action dependencies (go-gitea#37751)
  fix(deps): update module github.com/google/go-github/v85 to v86 (go-gitea#37754)
  ...

# Conflicts:
#	.github/workflows/pull-db-tests.yml
#	modules/storage/s3_test.go
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants