refactor: use a more modern writing style#947
Conversation
|
CI failed |
Signed-off-by: cuishuang <[email protected]>
Fixed. I have also passed the local tests.. Please review again. 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 ReportAll modified and coverable lines are covered by tests ✅
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. 🚀 New features to boost your workflow:
|
| } | ||
| 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) |
There was a problem hiding this comment.
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.

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.