8000 refactor: use a more modern writing style by cuishuang · Pull Request #947 · google/pprof · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

refactor: use a more modern writing style #947

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

Merged
merged 2 commits into from
Jun 29, 2025
Merged

Conversation

cuishuang
Copy link
Contributor

use go run golang.org/x/tools/gopls/internal/analysis/modernize/cmd/modernize@latest -fix -test ./... to make the code more modern and easy to read.

aalexand
aalexand previously approved these changes Jun 5, 2025
@aalexand
Copy link
Collaborator
aalexand commented Jun 6, 2025

CI failed

Signed-off-by: cuishuang <imcusg@gmail.com>
@cuishuang
Copy link
Contributor Author

CI failed

Fixed. I have also passed the local tests.. Please review again.

image

The reason for the inconsistency is due to slices.Clone, which relates to the details of nil slices and non-nil empty slices.

Related issues: golang/go#73557 and golang/go#73604.

Thank you once again.

@codecov-commenter
Copy link
codecov-commenter commented Jun 9, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 66.82%. Comparing base (0ed6a68) to head (24ad1e0).
Report is 80 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #947      +/-   ##
==========================================
- Coverage   66.86%   66.82%   -0.04%     
==========================================
  Files          44       44              
  Lines        9824     9840      +16     
==========================================
+ Hits         6569     6576       +7     
- Misses       2794     2825      +31     
+ Partials      461      439      -22     

☔ 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.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@@ -59,7 +59,7 @@ func Diff(b1, b2 []byte) (data []byte, err error) {
err = nil
}
if err != nil {
data = []byte(fmt.Sprintf("diff failed: %v\nb1: %q\nb2: %q\n", err, b1, b2))
data = fmt.Appendf(nil, "diff failed: %v\nb1: %q\nb2: %q\n", err, b1, b2)
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm not sure the new code is cleaner. I'd actually like to change the signature of these test functions from []byte to string one day and I think the current code can stay as is for now.

@aalexand aalexand merged commit e611ec3 into google:main Jun 29, 2025
49 checks passed
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.

3 participants
0