Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(12)

Issue 7393075: code review 7393075: strconv: Use Quote to escape the input string for faile...

Can't Edit
Can't Publish+Mail
Start Review
Created:
12 years, 6 months ago by mdbrown
Modified:
12 years, 6 months ago
Reviewers:
r
CC:
golang-dev, r, rsc
Visibility:
Public.

Description

strconv: Use Quote to escape the input string for failed conversion errors. This reveals the presence of control and non-printable characters in the errors returned by the Parse functions. Also add unit tests for NumError.

Patch Set 1 #

Patch Set 2 : diff -r e0b23d56fd6a https://code.google.com/p/go/ #

Total comments: 2

Patch Set 3 : diff -r e0b23d56fd6a https://code.google.com/p/go/ #

Unified diffs Side-by-side diffs Delta from patch set Stats (+26 lines, -1 line) Patch
M src/pkg/strconv/atof_test.go View 1 1 chunk +1 line, -0 lines 0 comments Download
M src/pkg/strconv/atoi.go View 1 1 chunk +1 line, -1 line 0 comments Download
M src/pkg/strconv/atoi_test.go View 1 2 3 chunks +24 lines, -0 lines 0 comments Download

Messages

Total messages: 11
mdbrown
Hello golang-dev@googlegroups.com, I'd like you to review this change to https://code.google.com/p/go/
12 years, 6 months ago (2013-02-27 21:08:04 UTC) #1
r
https://codereview.appspot.com/7393075/diff/1001/src/pkg/strconv/atoi_test.go File src/pkg/strconv/atoi_test.go (right): https://codereview.appspot.com/7393075/diff/1001/src/pkg/strconv/atoi_test.go#newcode192 src/pkg/strconv/atoi_test.go:192: for _, c := range []struct{ Num, Want string ...
12 years, 6 months ago (2013-02-27 21:32:47 UTC) #2
rsc
Please call CanBackquote first and preserve the current `` quoting where possible.
12 years, 6 months ago (2013-02-27 21:40:41 UTC) #3
mdbrown
Russ, do you mean something like if CanBackquote(e.Num) { quoted = "`" + e.Num + ...
12 years, 6 months ago (2013-02-27 23:01:18 UTC) #4
rsc
Yes, please. I think that will preserve the current string format except when there are ...
12 years, 6 months ago (2013-02-27 23:04:09 UTC) #5
mdbrown
I may not be following correctly but I think it has somewhat the opposite effect. ...
12 years, 6 months ago (2013-02-27 23:13:42 UTC) #6
rsc
My apologies for the wild goose chase. I misread this line: - return "strconv." + ...
12 years, 6 months ago (2013-02-28 03:18:17 UTC) #7
mdbrown
I've changed back to using a single call to Quote. https://codereview.appspot.com/7393075/diff/1001/src/pkg/strconv/atoi_test.go File src/pkg/strconv/atoi_test.go (right): https://codereview.appspot.com/7393075/diff/1001/src/pkg/strconv/atoi_test.go#newcode192 ...
12 years, 6 months ago (2013-02-28 16:55:01 UTC) #8
mdbrown
Hello golang-dev@googlegroups.com, r@golang.org, rsc@golang.org (cc: golang-dev@googlegroups.com), Please take another look.
12 years, 6 months ago (2013-02-28 16:55:24 UTC) #9
r
LGTM
12 years, 6 months ago (2013-02-28 18:00:53 UTC) #10
r
12 years, 6 months ago (2013-02-28 18:08:07 UTC) #11
*** Submitted as https://code.google.com/p/go/source/detail?r=7e7041319c25 ***

strconv: use Quote to escape the input string for failed conversion errors

This reveals the presence of control and non-printable characters in the
errors returned by the Parse functions.  Also add unit tests for NumError.

R=golang-dev, r, rsc
CC=golang-dev
https://codereview.appspot.com/7393075

Committer: Rob Pike <r@golang.org>
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b