strings and bytes.Split: make count of 0 mean 0, not infinite.

Use a count of -1 for infinity.  Ditto for Replace.

R=rsc
CC=golang-dev
https://golang.org/cl/1704044
This commit is contained in:
Rob Pike 2010-07-01 14:08:14 -07:00
parent 285312a05c
commit 38f1231f3e
24 changed files with 123 additions and 98 deletions

View file

@ -21,7 +21,7 @@ func initRewrite() {
if *rewriteRule == "" {
return
}
f := strings.Split(*rewriteRule, "->", 0)
f := strings.Split(*rewriteRule, "->", -1)
if len(f) != 2 {
fmt.Fprintf(os.Stderr, "rewrite rule must be of the form 'pattern -> replacement'\n")
os.Exit(2)