Skip to content

This PR is to add comments to newBitMapAllocator in pkg/ddc/base/portallocator/bitmap_allocator.go.#5737

Open
qnsy729 wants to merge 1 commit intofluid-cloudnative:masterfrom
qnsy729:comment-newBitMapAllocator
Open

This PR is to add comments to newBitMapAllocator in pkg/ddc/base/portallocator/bitmap_allocator.go.#5737
qnsy729 wants to merge 1 commit intofluid-cloudnative:masterfrom
qnsy729:comment-newBitMapAllocator

Conversation

@qnsy729
Copy link
Copy Markdown

@qnsy729 qnsy729 commented Mar 27, 2026

I. Describe what this PR does

This PR adds function-level comments to newBitMapAllocator in pkg/ddc/base/portallocator/bitmap_allocator.go.

II. Does this pull request fix one issue?

fixes #5736

III. Special notes for reviews

The change only adds comments and does not modify business logic.

@fluid-e2e-bot
Copy link
Copy Markdown

fluid-e2e-bot bot commented Mar 27, 2026

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign cheyang for approval by writing /assign @cheyang in a comment. For more information see:The Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@fluid-e2e-bot
Copy link
Copy Markdown

fluid-e2e-bot bot commented Mar 27, 2026

Hi @qnsy729. Thanks for your PR.

I'm waiting for a fluid-cloudnative member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@sonarqubecloud
Copy link
Copy Markdown

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request adds documentation comments to the newBitMapAllocator function in the port allocator package. A review comment suggests refining the documentation to be more concise and idiomatic by removing redundant information and implementation details, providing a specific code suggestion for the improvement.

Comment on lines +38 to +40
// newBitMapAllocator creates a bitmap-based port allocator for the given port range.
// It initializes the underlying allocator and returns a BitMapAllocator instance.
// It returns an error if the allocator cannot be created.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

This comment is a bit verbose and contains some repetition. For better readability and adherence to Go's idiomatic documentation style (as described in Effective Go), it could be made more concise.

Specifically:

  • The phrases creates a bitmap-based port allocator and returns a BitMapAllocator instance are redundant.
  • Mentioning that it initializes the underlying allocator is an implementation detail that can be omitted.

A single-line comment would be more idiomatic here.

Suggested change
// newBitMapAllocator creates a bitmap-based port allocator for the given port range.
// It initializes the underlying allocator and returns a BitMapAllocator instance.
// It returns an error if the allocator cannot be created.
// newBitMapAllocator creates a new BitMapAllocator for the given port range, returning an error if creation fails.

@qnsy729
Copy link
Copy Markdown
Author

qnsy729 commented Mar 27, 2026

/assign @cheyang

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add comments to newBitMapAllocator in pkg/ddc/base/portallocator/bitmap_allocator.go.

2 participants