refactor: use strings.Cut to simplify code#22590
Merged
chlins merged 3 commits intogoharbor:mainfrom Jan 15, 2026
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #22590 +/- ##
===========================================
+ Coverage 45.36% 65.87% +20.50%
===========================================
Files 244 1073 +829
Lines 13333 116279 +102946
Branches 2719 2931 +212
===========================================
+ Hits 6049 76593 +70544
- Misses 6983 35438 +28455
- Partials 301 4248 +3947
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
Contributor
Author
|
@chlins Thank you for your approval. If there's anything need I to do, please feel free to let me know. |
Contributor
Author
|
@chlins friendly ping~ 😄 |
Signed-off-by: liuyueyangxmu <liuyueyangxmu@outlook.com>
reasonerjt
approved these changes
Jan 15, 2026
intojhanurag
pushed a commit
to intojhanurag/harbor
that referenced
this pull request
Jan 22, 2026
Signed-off-by: liuyueyangxmu <liuyueyangxmu@outlook.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Thank you for contributing to Harbor!
Comprehensive Summary of your change
The
strings.Cutfunction was introduced in Go 1.18 as part of a proposal to add more efficient string manipulation functions.This change enhances code readability and makes it easier to understand the intent of the operation, as strings.Cut directly provides the substring before the specified delimiter, along with a boolean indicating its presence.
More info can see Go Issue golang/go#46336
Issue being fixed
Please indicate you've done the following: