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

Issue 2265044: strings: Contains (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
14 years, 7 months ago by brad_danga_com
Modified:
14 years, 5 months ago
Reviewers:
CC:
rsc, r2, r, golang-dev
Visibility:
Public.

Description

strings: Contains Tiny helper to avoid strings.Index(s, sub) != -1

Patch Set 1 #

Patch Set 2 : code review 2265044: strings: Contains #

Patch Set 3 : code review 2265044: strings: Contains #

Patch Set 4 : code review 2265044: strings: Contains #

Patch Set 5 : code review 2265044: strings: Contains #

Unified diffs Side-by-side diffs Delta from patch set Stats (+38 lines, -12 lines) Patch
M src/pkg/exec/lp_unix.go View 1 chunk +1 line, -1 line 0 comments Download
M src/pkg/exec/lp_windows.go View 1 chunk +1 line, -1 line 0 comments Download
M src/pkg/fmt/fmt_test.go View 1 chunk +1 line, -1 line 0 comments Download
M src/pkg/http/request.go View 2 chunks +2 lines, -2 lines 0 comments Download
M src/pkg/http/server.go View 3 4 1 chunk +2 lines, -2 lines 0 comments Download
M src/pkg/http/transfer.go View 3 2 chunks +2 lines, -2 lines 0 comments Download
M src/pkg/http/url.go View 1 chunk +1 line, -1 line 0 comments Download
M src/pkg/smtp/smtp.go View 1 chunk +1 line, -1 line 0 comments Download
M src/pkg/strconv/quote.go View 1 chunk +1 line, -1 line 0 comments Download
M src/pkg/strings/strings.go View 1 chunk +5 lines, -0 lines 0 comments Download
M src/pkg/strings/strings_test.go View 1 1 chunk +21 lines, -0 lines 0 comments Download

Messages

Total messages: 13
brad_danga_com
Should I drop this? I think it makes code more readable, though, with less boiler-plate.
14 years, 6 months ago (2010-10-22 19:28:31 UTC) #1
r2
It's simple but I agree it's more readable. I could accept it. Please obey r's ...
14 years, 6 months ago (2010-10-22 20:13:35 UTC) #2
brad_danga_com
PTAL Added tests with the empty string.
14 years, 6 months ago (2010-11-01 14:31:42 UTC) #3
r2
So far so good. Now comes the annoying part. It would be good to include, ...
14 years, 6 months ago (2010-11-01 17:51:53 UTC) #4
rsc
gofmt -l -r 'strings.Index(a, b) >= 0 -> strings.Contains(a, b)' $GOROOT/src/pkg (and also != -1) ...
14 years, 6 months ago (2010-11-01 17:56:51 UTC) #5
brad_danga_com
gofmt continues to impress me. PTAL.
14 years, 6 months ago (2010-11-01 19:25:46 UTC) #6
r2
looking good. what about the !Contains case? -rob
14 years, 6 months ago (2010-11-01 19:53:05 UTC) #7
brad_danga_com
PTAL Looks like there was only one case of !Contains, in http/transfer.go: http://codereview.appspot.com/2265044/patch/14001/15006
14 years, 6 months ago (2010-11-01 21:12:20 UTC) #8
r2
LGTM
14 years, 6 months ago (2010-11-01 21:14:20 UTC) #9
r2
Looks like you need to sync and resolve tubenose=% hg clpatch 2265044 edit src/pkg/http/server.go: patch ...
14 years, 6 months ago (2010-11-01 21:15:29 UTC) #10
brad_danga_com
PTAL did an hg sync and ./all.bash.
14 years, 6 months ago (2010-11-01 21:23:35 UTC) #11
r2
the cmd directory could use the same surgery, but let's do that in a separate ...
14 years, 6 months ago (2010-11-01 21:32:30 UTC) #12
r
14 years, 6 months ago (2010-11-01 21:32:52 UTC) #13
*** Submitted as http://code.google.com/p/go/source/detail?r=42d67a1ac6fb ***

strings: Contains

Tiny helper to avoid strings.Index(s, sub) != -1

R=rsc, r2, r
CC=golang-dev
http://codereview.appspot.com/2265044

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