Skip to content

Conversation

suwakei
Copy link
Contributor

@suwakei suwakei commented Jul 7, 2025

I would suggest some improvements to further improve robustness and readability

##Proposal

Improve robustness of joinPaths function

Currently, the joinPaths function uses a homebrew lastChar function to determine if a path ends with a trailing slash. lastChar is a potential risk because it panics when passed an empty string. Replacing this logic with strings.HasSuffix, which is safer and clearer in intent, improves robustness and readability.
This change also eliminates the need for the lastChar function,
making the code base simpler.

Simplify isASCII functions

The current isASCII function is implemented using a for loop; it can be rewritten to be more modern and concise using strings.ContainsFunc, available in Go 1.19 and later. is safe.

Delete unnecessary tests

In conjunction with the removal of the lastChar function, we have also removed the associated test in utils_test.go.

Copy link

codecov bot commented Jul 13, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.92%. Comparing base (3dc1cd6) to head (e8622bf).
Report is 142 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4288      +/-   ##
==========================================
- Coverage   99.21%   98.92%   -0.30%     
==========================================
  Files          42       44       +2     
  Lines        3182     3431     +249     
==========================================
+ Hits         3157     3394     +237     
- Misses         17       26       +9     
- Partials        8       11       +3     
Flag Coverage Δ
?
--ldflags="-checklinkname=0" -tags sonic 98.85% <100.00%> (?)
-tags go_json 98.85% <100.00%> (?)
-tags nomsgpack 98.90% <100.00%> (?)
go-1.18 ?
go-1.19 ?
go-1.20 ?
go-1.21 ?
go-1.23 98.92% <100.00%> (?)
go-1.24 98.92% <100.00%> (?)
macos-latest 98.92% <100.00%> (-0.30%) ⬇️
ubuntu-latest 98.92% <100.00%> (-0.30%) ⬇️

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

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@suwakei
Copy link
Contributor Author

suwakei commented Jul 13, 2025

Codecov's overall project coverage is showing as -0.30% and failed, but for my changes (diffs), everything is covered by the tests (100%).
Please contact me to discuss additional tests if needed.

@suwakei
Copy link
Contributor Author

suwakei commented Jul 16, 2025

Hi! Just following up to see if there's anything I can improve in this PR 🙇

@suwakei
Copy link
Contributor Author

suwakei commented Jul 29, 2025

Hi maintainers 👋
Just following up on this PR — happy to make any changes if needed. Please let me know if there's anything blocking review. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant