-
-
Notifications
You must be signed in to change notification settings - Fork 145
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
Remove duplicated backslash in string escaping #458
Conversation
Codecov Report
@@ Coverage Diff @@
## main #458 +/- ##
==========================================
+ Coverage 46.47% 46.56% +0.09%
==========================================
Files 70 70
Lines 5730 5723 -7
==========================================
+ Hits 2663 2665 +2
+ Misses 2773 2764 -9
Partials 294 294
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
50aa768
to
823ad0c
Compare
go test -tags bench -benchmem -bench=. ./test/bench -memprofile=mem.prof -cpuprofile=cpu.prof | tee output.txt | ||
mkfifo pipe | ||
tee output.txt < pipe & | ||
go test -tags bench -benchmem -bench=. ./test/bench -memprofile=mem.prof -cpuprofile=cpu.prof > pipe |
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.
The exit status of benchmark test has been ignored, because the exit status of a pipeline is the exit status of the last command (tee
) in the pipeline.
To reveal the original exit status, piping command is separated.
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.
Thanks for the detailed description.
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.
Thanks for your contribution.
go test -tags bench -benchmem -bench=. ./test/bench -memprofile=mem.prof -cpuprofile=cpu.prof | tee output.txt | ||
mkfifo pipe | ||
tee output.txt < pipe & | ||
go test -tags bench -benchmem -bench=. ./test/bench -memprofile=mem.prof -cpuprofile=cpu.prof > pipe |
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.
Thanks for the detailed description.
What this PR does / why we need it:
At PR #439, I escaped RHT key and value strings to fix issue #437.
When checking
EscapeString()
function at that time, I thought it should put two backslashes in front of special characters, becauseJSON.stringify()
in JavaScript added two backslashes. For example, the return value ofJSON.stringify({"key": "value\n"})
is'{"key":"value\\n"}'
.However, the additional backslash in the example above is just to represent a single backslash in JS string. Valid JSON string uses only a single backslash for control characters.
Since the updated
EscapeString()
makes invalid JSON strings, it should be reverted.Which issue(s) this PR fixes:
Fixes #439 and #443
Special notes for your reviewer:
Does this PR introduce a user-facing change?:
Additional documentation:
Checklist: