Skip to content

Conversation

@arturmelanchyk
Copy link

Pull Request Checklist

Please ensure your pull request meets the following requirements:

  • Open your pull request against the master branch.
  • All tests pass in available continuous integration systems (e.g., GitHub Actions).
  • Tests are added or modified as needed to cover code changes.
  • If the pull request introduces a new feature, the feature is documented in the docs/doc.md.

Thank you for contributing!

const stackBufSize = 128

// Use a static sized buffer on the stack in the common case.
// If the path is too long, allocate a buffer on the heap instead.
Copy link
Author

Choose a reason for hiding this comment

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

escape analysis explicitly states that it actually wont be allcated on stack

./tree.go:676:13: make([]byte, 0, 128) escapes to heap

@arturmelanchyk arturmelanchyk marked this pull request as ready for review November 1, 2025 19:11
@appleboy appleboy requested a review from Copilot November 3, 2025 04:31
@appleboy appleboy added this to the v1.12 milestone Nov 3, 2025
@codecov
Copy link

codecov bot commented Nov 3, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.96%. Comparing base (3dc1cd6) to head (bd2679c).
⚠️ Report is 197 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4417      +/-   ##
==========================================
- Coverage   99.21%   98.96%   -0.25%     
==========================================
  Files          42       44       +2     
  Lines        3182     2897     -285     
==========================================
- Hits         3157     2867     -290     
- Misses         17       19       +2     
- Partials        8       11       +3     
Flag Coverage Δ
?
--ldflags="-checklinkname=0" -tags sonic 98.95% <100.00%> (?)
-tags go_json 98.88% <100.00%> (?)
-tags nomsgpack 98.94% <100.00%> (?)
go-1.18 ?
go-1.19 ?
go-1.20 ?
go-1.21 ?
go-1.24 98.96% <100.00%> (?)
go-1.25 98.96% <100.00%> (?)
macos-latest 98.96% <100.00%> (-0.25%) ⬇️
ubuntu-latest 98.96% <100.00%> (-0.25%) ⬇️

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.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR refactors the buffer allocation logic in the findCaseInsensitivePath function to use Go's built-in max function, simplifying the code while maintaining the same behavior.

  • Replaced conditional buffer allocation with a single line using max(stackBufSize, len(path)+1)

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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.

2 participants