1
0
mirror of https://github.com/golang/go synced 2024-11-26 06:57:56 -07:00

gofmt-ify bytes

R=r
http://go/go-review/1016044
This commit is contained in:
Robert Griesemer 2009-11-04 16:49:28 -08:00
parent 789b31a416
commit 688a6ff71d
2 changed files with 4 additions and 3 deletions

View File

@ -46,7 +46,7 @@ func (b *Buffer) Bytes() []byte {
func (b *Buffer) String() string { func (b *Buffer) String() string {
if b == nil { if b == nil {
// Special case, useful in debugging. // Special case, useful in debugging.
return "<nil>" return "<nil>";
} }
return string(b.buf[b.off : len(b.buf)]); return string(b.buf[b.off : len(b.buf)]);
} }

View File

@ -278,7 +278,8 @@ func TrimSpace(s []byte) []byte {
rune := int(s[end-1]); rune := int(s[end-1]);
if rune >= utf8.RuneSelf { if rune >= utf8.RuneSelf {
// Back up carefully looking for beginning of rune. Mustn't pass start. // Back up carefully looking for beginning of rune. Mustn't pass start.
for wid = 2; start <= end-wid && !utf8.RuneStart(s[end-wid]); wid++ {} for wid = 2; start <= end-wid && !utf8.RuneStart(s[end-wid]); wid++ {
}
if start > end-wid { // invalid UTF-8 sequence; stop processing if start > end-wid { // invalid UTF-8 sequence; stop processing
return s[start:end]; return s[start:end];
} }