go.mod: update to go1.25, use waitgroup.Go, and enable modernize linter - #3269
Conversation
797b751 to
9966f95
Compare
There was a problem hiding this comment.
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/Donegoroutine patterns withWaitGroup.Go. - Modernize concurrency primitives (typed
atomic.Uint32) and enable themodernizegolangci-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.
There was a problem hiding this comment.
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'srequirewill callt.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 withoutFailNow(e.g., explicitif err != nil { t.Errorf(...); return }) or send errors back to the main goroutine andrequirethere afterwg.Wait().
publisher, err := brokerClient.PublishLogs(ctx)
require.NoError(t, err)
defer func() {
_, err := publisher.CloseAndRecv()
Codecov Report❌ Patch coverage is 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:
|
| module github.com/moby/swarmkit/swarmd | ||
|
|
||
| go 1.24.0 | ||
| go 1.25 |
There was a problem hiding this comment.
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>
- How I did it
- How to test it
- Description for the changelog