-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Dockerfile: update golangci-lint to v2.9.0 and fix linting #6789
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
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>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
d380bb6 to
a934c75
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR updates the golangci-lint version to v2.9.0 and resolves linting issues identified by the updated linter. The changes primarily focus on optimizing slice allocations by preallocating capacity where the final size is known, which improves performance and memory efficiency. The PR also includes cleanup of nolint directives and minor code refactoring.
Changes:
- Updated golangci-lint version from v2.6.1 to v2.9.0 in Dockerfile.lint
- Preallocated slices with known capacity throughout the codebase to satisfy the
prealloclinter - Removed unnecessary
nolint:preallocandnolint:perfsprintdirectives where code now satisfies the linter - Added
nolint:preallocdirectives in test files where preallocation would over-complicate test initialization
Reviewed changes
Copilot reviewed 18 out of 18 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| dockerfiles/Dockerfile.lint | Updated golangci-lint version from v2.6.1 to v2.9.0 |
| opts/swarmopts/secret.go | Preallocated secrets slice with capacity based on o.values length |
| opts/swarmopts/config.go | Preallocated configs slice with capacity based on o.values length |
| opts/mount.go | Preallocated mounts slice with capacity based on m.values length |
| opts/gpus.go | Preallocated gpus slice with capacity based on o.values length |
| internal/volumespec/volumespec.go | Preallocated buffer with spec length capacity; use buffer[:0] to reset |
| cli/connhelper/ssh/ssh.go | Removed nolint:perfsprint directive (no longer needed) |
| cli/compose/loader/merge.go | Preallocated slices in multiple converter functions based on map length |
| cli/compose/convert/service.go | Added early nil return for empty preferences; preallocated slices; moved refs declaration after validation |
| cli/command/system/events.go | Preallocated keys and attrs slices with known capacities |
| cli/command/swarm/opts.go | Preallocated externalCAs slice with capacity based on m.values length |
| cli/command/stack/loader.go | Moved dicts computation after loader.Load success; preallocated dicts slice |
| cli/command/service/update.go | Removed nolint:prealloc directive (no longer needed) |
| cli/command/service/progress/progress_test.go | Added nolint:prealloc directives for test data initialization; changed slice composite literals |
| cli/command/service/list_test.go | Preallocated matrix slice with capacity based on tests length |
| cli/command/image/build_test.go | Changed to var declaration for headers; preallocated names slice after getting headers length |
| cli/command/formatter/container.go | Removed nolint:prealloc directive (no longer needed) |
| cli-plugins/manager/cobra.go | Added nolint:prealloc directive for simple slice initialization |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- What I did
- How I did it
- How to verify it
- Human readable description for the release notes
- A picture of a cute animal (not mandatory but encouraged)