Skip to content

Conversation

@thaJeztah
Copy link
Member

- Human readable description for the release notes

- A picture of a cute animal (not mandatory but encouraged)

@thaJeztah thaJeztah added this to the 29.0.0 milestone Oct 6, 2025
@thaJeztah thaJeztah added status/2-code-review kind/refactor PR's that refactor, or clean-up code labels Oct 6, 2025
@codecov-commenter
Copy link

codecov-commenter commented Oct 6, 2025

Codecov Report

❌ Patch coverage is 62.50000% with 3 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
cli/command/container/opts.go 62.50% 2 Missing and 1 partial ⚠️

📢 Thoughts on this report? Let us know!

Copy link

Copilot AI left a 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 refactors variable declarations in the container options parsing code to inline variable assignments where appropriate, improving code readability and reducing unnecessary variable declarations.

  • Inlined variable declarations for port parsing operations
  • Improved slice initialization with capacity hints for device mappings
  • Reduced variable scope by moving declarations closer to usage

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment on lines +468 to +469
deviceMappings := make([]container.DeviceMapping, 0, len(devices))
cdiDeviceNames := make([]string, 0, len(devices))
Copy link

Copilot AI Oct 6, 2025

Choose a reason for hiding this comment

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

Consider using nil initialization for these slices instead of pre-allocating with capacity. Since you're only appending selectively (CDI devices to cdiDeviceNames, validated devices to deviceMappings), the actual usage may be much less than the full capacity, making pre-allocation potentially wasteful.

Suggested change
deviceMappings := make([]container.DeviceMapping, 0, len(devices))
cdiDeviceNames := make([]string, 0, len(devices))
var deviceMappings []container.DeviceMapping
var cdiDeviceNames []string

Copilot uses AI. Check for mistakes.
Copy link
Member Author

Choose a reason for hiding this comment

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

LOL; go fight that battle with the linter, CoPilot, I changed it because the linter didn't like your suggestion 😜

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah always have to read through these to understand if the feedback is anything worth actually actioning or not.

@austinvazquez austinvazquez merged commit 30ec4c0 into docker:master Oct 6, 2025
87 checks passed
@thaJeztah thaJeztah deleted the cleanups branch October 6, 2025 21:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/refactor PR's that refactor, or clean-up code status/2-code-review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants