Skip to content

go.mod: update to go1.25, use waitgroup.Go, and enable modernize linter - #3269

Merged
thaJeztah merged 9 commits into
moby:masterfrom
thaJeztah:go_1.25
Jul 28, 2026
Merged

go.mod: update to go1.25, use waitgroup.Go, and enable modernize linter#3269
thaJeztah merged 9 commits into
moby:masterfrom
thaJeztah:go_1.25

Conversation

@thaJeztah

Copy link
Copy Markdown
Member

- How I did it

- How to test it

- Description for the changelog

@thaJeztah
thaJeztah force-pushed the go_1.25 branch 4 times, most recently from 797b751 to 9966f95 Compare July 28, 2026 19:42
@thaJeztah
thaJeztah requested a review from Copilot July 28, 2026 19:49

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the SwarmKit codebase to target Go 1.25 and adopts new Go 1.25-era standard library conveniences (notably sync.WaitGroup.Go and typed atomics), while also enabling the modernize linter to enforce/encourage newer idioms.

Changes:

  • Bump module/workspace Go version directives to Go 1.25.
  • Replace several manual WaitGroup.Add/Done goroutine patterns with WaitGroup.Go.
  • Modernize concurrency primitives (typed atomic.Uint32) and enable the modernize golangci-lint linter.

Reviewed changes

Copilot reviewed 14 out of 14 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
watch/watch_test.go Refactors benchmark goroutine spawning to use WaitGroup.Go.
swarmd/go.work Bumps workspace Go version directive to 1.25.
swarmd/go.mod Bumps swarmd module Go version directive to 1.25.
node/node.go Uses WaitGroup.Go for node component goroutines and removes manual Add/Done.
manager/state/store/memory_test.go Uses WaitGroup.Go in benchmark concurrency helpers.
manager/state/raft/raft.go Switches uint32 atomics to typed atomic.Uint32 fields and updates call sites.
manager/orchestrator/update/updater.go Uses WaitGroup.Go for worker goroutines (but currently leaves a blocking Add).
manager/logbroker/broker_test.go Uses WaitGroup.Go for log publishing goroutines in tests.
manager/controlapi/service.go Uses slices.Contains for reserved-name validation and adds slices import.
manager/allocator/allocator.go Simplifies closure capture and uses WaitGroup.Go for allocator actor goroutine.
integration/cluster_test.go Uses WaitGroup.Go in integration test node lifecycle goroutines and removes unused import.
go.mod Bumps root module Go version directive to 1.25.
agent/worker.go Uses WaitGroup.Go for concurrent log subscriptions.
.golangci.yml Enables the modernize linter.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread manager/orchestrator/update/updater.go

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 14 out of 14 changed files in this pull request and generated no new comments.

Comments suppressed due to low confidence (1)

manager/logbroker/broker_test.go:88

  • require.NoError(t, ...) is called inside a goroutine. If any of these assertions fail, testify's require will call t.FailNow, which is not safe from a non-test goroutine and can panic with "FailNow called from goroutine other than test goroutine". Prefer reporting errors without FailNow (e.g., explicit if err != nil { t.Errorf(...); return }) or send errors back to the main goroutine and require there after wg.Wait().
					publisher, err := brokerClient.PublishLogs(ctx)
					require.NoError(t, err)

					defer func() {
						_, err := publisher.CloseAndRecv()

@codecov-commenter

codecov-commenter commented Jul 28, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 60.00000% with 14 lines in your changes missing coverage. Please review.
✅ Project coverage is 14.71%. Comparing base (6e9e7b8) to head (8b8847d).
⚠️ Report is 46 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3269      +/-   ##
==========================================
- Coverage   14.73%   14.71%   -0.02%     
==========================================
  Files         200      200              
  Lines       93077    93027      -50     
==========================================
- Hits        13712    13689      -23     
+ Misses      78019    77993      -26     
+ Partials     1346     1345       -1     
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@thaJeztah
thaJeztah marked this pull request as ready for review July 28, 2026 20:41
@thaJeztah
thaJeztah requested review from corhere and vvoland July 28, 2026 20:42
Comment thread swarmd/go.mod Outdated
module github.com/moby/swarmkit/swarmd

go 1.24.0
go 1.25

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually; probably should just use go 1.25.0 - #3257 would add the patch version back again either way, so we may as well just keep it.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
    manager/state/raft/raft.go:117:2: atomictypes: var signalledLeadership uint32 may be simplified using atomic.Uint32 (modernize)
        signalledLeadership uint32
        ^
    manager/state/raft/raft.go:118:2: atomictypes: var isMember uint32 may be simplified using atomic.Uint32 (modernize)
        isMember            uint32
        ^
    manager/state/raft/raft.go:164:2: atomictypes: var ticksWithNoLeader uint32 may be simplified using atomic.Uint32 (modernize)
        ticksWithNoLeader   uint32
        ^

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
@thaJeztah

Copy link
Copy Markdown
Member Author

cc @corhere @vvoland ptal

@thaJeztah
thaJeztah merged commit 5418507 into moby:master Jul 28, 2026
8 checks passed
@thaJeztah
thaJeztah deleted the go_1.25 branch July 28, 2026 23:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants