summaryrefslogtreecommitdiff
path: root/src/pkg/patch/patch.go
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2009-11-20 11:45:05 -0800
committerRuss Cox <rsc@golang.org>2009-11-20 11:45:05 -0800
commitc861f30835090bbd6b9b35a80667f26952843767 (patch)
tree645bd57ef3c9326ec02e646a751b9075d12a79e7 /src/pkg/patch/patch.go
parent7089e97992d5d6be520dfea787200061992526c8 (diff)
downloadgolang-c861f30835090bbd6b9b35a80667f26952843767.tar.gz
gofmt -r 'α[β:len(α)] -> α[β:]' -w src/cmd src/pkg
R=r, gri CC=golang-dev http://codereview.appspot.com/156115
Diffstat (limited to 'src/pkg/patch/patch.go')
-rw-r--r--src/pkg/patch/patch.go16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/pkg/patch/patch.go b/src/pkg/patch/patch.go
index 81a2dfcfc..d04b78865 100644
--- a/src/pkg/patch/patch.go
+++ b/src/pkg/patch/patch.go
@@ -100,13 +100,13 @@ func Parse(text []byte) (*Set, os.Error) {
// begins the section. After that is the file name.
s, raw, _ := getLine(raw, 1);
if hasPrefix(s, "Index: ") {
- p.Dst = string(bytes.TrimSpace(s[7:len(s)]));
+ p.Dst = string(bytes.TrimSpace(s[7:]));
goto HaveName;
} else if hasPrefix(s, "diff ") {
str := string(bytes.TrimSpace(s));
i := strings.LastIndex(str, " b/");
if i >= 0 {
- p.Dst = str[i+3 : len(str)];
+ p.Dst = str[i+3:];
goto HaveName;
}
}
@@ -240,7 +240,7 @@ func getLine(data []byte, n int) (first []byte, rest []byte, ok bool) {
ok = false;
break;
}
- rest = rest[nl+1 : len(rest)];
+ rest = rest[nl+1:];
}
first = data[0 : len(data)-len(rest)];
return;
@@ -260,7 +260,7 @@ func sections(text []byte, prefix string) ([]byte, [][]byte) {
if nl < 0 {
break
}
- b = b[nl+1 : len(b)];
+ b = b[nl+1:];
}
sect := make([][]byte, n+1);
@@ -276,9 +276,9 @@ func sections(text []byte, prefix string) ([]byte, [][]byte) {
sect[n] = text;
break;
}
- b = b[nl+1 : len(b)];
+ b = b[nl+1:];
}
- return sect[0], sect[1:len(sect)];
+ return sect[0], sect[1:];
}
// if s begins with the prefix t, skip returns
@@ -287,7 +287,7 @@ func skip(s []byte, t string) (ss []byte, ok bool) {
if len(s) < len(t) || string(s[0:len(t)]) != t {
return nil, false
}
- return s[len(t):len(s)], true;
+ return s[len(t):], true;
}
// if s begins with the prefix t and then is a sequence
@@ -305,7 +305,7 @@ func atoi(s []byte, t string, base int) (n int, ss []byte, ok bool) {
if i == 0 {
return
}
- return n, s[i:len(s)], true;
+ return n, s[i:], true;
}
// hasPrefix returns true if s begins with t.