-
-
Notifications
You must be signed in to change notification settings - Fork 137
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
Fix parser #554
Fix parser #554
Conversation
goccy
commented
Nov 29, 2024
•
edited
Loading
edited
Codecov ReportAttention: Patch coverage is
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. Additional details and impacted files@@ Coverage Diff @@
## master #554 +/- ##
==========================================
+ Coverage 77.00% 77.09% +0.09%
==========================================
Files 21 21
Lines 7270 7321 +51
==========================================
+ Hits 5598 5644 +46
- Misses 1277 1283 +6
+ Partials 395 394 -1 |
var marker string | ||
if len(src) == 3 { | ||
marker = string(src) | ||
} else { | ||
marker = strings.TrimRightFunc(string(src[:4]), func(r rune) bool { | ||
return r == ' ' || r == '\t' || r == '\n' || r == '\r' | ||
}) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps we can simplify:
var marker string | |
if len(src) == 3 { | |
marker = string(src) | |
} else { | |
marker = strings.TrimRightFunc(string(src[:4]), func(r rune) bool { | |
return r == ' ' || r == '\t' || r == '\n' || r == '\r' | |
}) | |
} | |
marker := string(src) | |
if len(src) != 3 { | |
marker = strings.TrimRightFunc(string(src[:4]), unicode.IsSpace) | |
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IsSpace contains \v
and others, so it does not compatible this function.
https://pkg.go.dev/unicode#IsSpace