Skip to content

refactor: use strings.Cut to simplify code#22590

Merged
chlins merged 3 commits intogoharbor:mainfrom
liuyueyangxmu:main
Jan 15, 2026
Merged

refactor: use strings.Cut to simplify code#22590
chlins merged 3 commits intogoharbor:mainfrom
liuyueyangxmu:main

Conversation

@liuyueyangxmu
Copy link
Copy Markdown
Contributor

@liuyueyangxmu liuyueyangxmu commented Nov 26, 2025

Thank you for contributing to Harbor!

Comprehensive Summary of your change

The strings.Cut function 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:

  • Well Written Title and Summary of the PR
  • Label the PR as needed. "release-note/ignore-for-release, release-note/new-feature, release-note/update, release-note/enhancement, release-note/community, release-note/breaking-change, release-note/docs, release-note/infra, release-note/deprecation"
  • Accepted the DCO. Commits without the DCO will delay acceptance.
  • Made sure tests are passing and test coverage is added if needed.
  • Considered the docs impact and opened a new docs issue or PR with docs changes if needed in website repository.

Copy link
Copy Markdown
Member

@chlins chlins left a comment

Choose a reason for hiding this comment

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

lgtm

@chlins chlins added the release-note/update Update or Fix label Nov 26, 2025
@codecov
Copy link
Copy Markdown

codecov Bot commented Nov 26, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 65.87%. Comparing base (c8c11b4) to head (9af18d1).
⚠️ Report is 617 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@             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     
Flag Coverage Δ
unittests 65.87% <100.00%> (+20.50%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
src/common/utils/utils.go 82.05% <100.00%> (ø)
src/controller/event/handler/util/util.go 33.33% <100.00%> (ø)

... and 986 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@liuyueyangxmu
Copy link
Copy Markdown
Contributor Author

@chlins Thank you for your approval.

If there's anything need I to do, please feel free to let me know.

@liuyueyangxmu
Copy link
Copy Markdown
Contributor Author

@chlins friendly ping~ 😄

Signed-off-by: liuyueyangxmu <liuyueyangxmu@outlook.com>
@chlins chlins merged commit 76f0a46 into goharbor:main Jan 15, 2026
12 checks passed
intojhanurag pushed a commit to intojhanurag/harbor that referenced this pull request Jan 22, 2026
Signed-off-by: liuyueyangxmu <liuyueyangxmu@outlook.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release-note/update Update or Fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants