-
Notifications
You must be signed in to change notification settings - Fork 4.1k
chore: replace strings.SplitN(arg, sep, 2) with strings.Cut(arg, sep) #24147
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
Conversation
|
@healthyyyoung lint failing |
7c0d9f3 to
c2ad35b
Compare
|
@technicallyty merge branch, noticed tag:v54 Should we merge this PR into v54? |
📝 WalkthroughWalkthroughThis pull request refactors the string parsing logic for key-value pairs across multiple components. In two flag-related files, the existing methods that used Changes
Sequence Diagram(s)sequenceDiagram
participant Caller
participant CompositeMapValue
participant Parser as strings.Cut
Caller->>CompositeMapValue: Call Set(arg)
CompositeMapValue->>Parser: Cut(arg, "=")
alt Key-value pair not found
Parser-->>CompositeMapValue: found = false
CompositeMapValue-->>Caller: Return error ("invalid format")
else Key-value pair found
Parser-->>CompositeMapValue: Return key, value, found = true
CompositeMapValue->>CompositeMapValue: Process key with keyParser(key)
CompositeMapValue->>CompositeMapValue: Process value with valueParser(value)
CompositeMapValue-->>Caller: Return success
end
sequenceDiagram
participant Caller
participant parsePath
participant Cutter as strings.Cut
Caller->>parsePath: Call parsePath(path)
alt Path does not start with "/"
parsePath-->>Caller: Return error ("invalid path")
else Valid path
parsePath->>Cutter: Cut(path, "/")
alt Subpath is found
Cutter-->>parsePath: Return storeName, subpath
parsePath->>parsePath: Prefix subpath with "/"
parsePath-->>Caller: Return (storeName, "/" + subpath)
else Subpath is not found
Cutter-->>parsePath: Return storeName, ""
parsePath-->>Caller: Return (storeName, nil)
end
end
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (4)
⏰ Context from checks skipped due to timeout of 90000ms (15)
🔇 Additional comments (7)
✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
Description
Closes: #23954
Author Checklist
All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.
I have...
!in the type prefix if API or client breaking changeCHANGELOG.mdReviewers Checklist
All items are required. Please add a note if the item is not applicable and please add
your handle next to the items reviewed if you only reviewed selected items.
Please see Pull Request Reviewer section in the contributing guide for more information on how to review a pull request.
I have...
Summary by CodeRabbit
Refactor
Tests