From 5fea2ccc77eb50a9704fa04b7c61755fe34e1d95 Mon Sep 17 00:00:00 2001 From: Brad Fitzpatrick Date: Tue, 1 Mar 2016 23:21:55 +0000 Subject: all: single space after period. The tree's pretty inconsistent about single space vs double space after a period in documentation. Make it consistently a single space, per earlier decisions. This means contributors won't be confused by misleading precedence. This CL doesn't use go/doc to parse. It only addresses // comments. It was generated with: $ perl -i -npe 's,^(\s*// .+[a-z]\.) +([A-Z]),$1 $2,' $(git grep -l -E '^\s*//(.+\.) +([A-Z])') $ go test go/doc -update Change-Id: Iccdb99c37c797ef1f804a94b22ba5ee4b500c4f7 Reviewed-on: https://go-review.googlesource.com/20022 Reviewed-by: Rob Pike Reviewed-by: Dave Day Run-TryBot: Brad Fitzpatrick TryBot-Result: Gobot Gobot --- src/bytes/buffer.go | 10 +++++----- src/bytes/bytes.go | 18 +++++++++--------- src/bytes/bytes_test.go | 4 ++-- src/bytes/compare_test.go | 2 +- src/bytes/equal_test.go | 4 ++-- 5 files changed, 19 insertions(+), 19 deletions(-) (limited to 'src/bytes') diff --git a/src/bytes/buffer.go b/src/bytes/buffer.go index 1aed86924d..992a9585e7 100644 --- a/src/bytes/buffer.go +++ b/src/bytes/buffer.go @@ -44,7 +44,7 @@ var ErrTooLarge = errors.New("bytes.Buffer: too large") func (b *Buffer) Bytes() []byte { return b.buf[b.off:] } // String returns the contents of the unread portion of the buffer -// as a string. If the Buffer is a nil pointer, it returns "". +// as a string. If the Buffer is a nil pointer, it returns "". func (b *Buffer) String() string { if b == nil { // Special case, useful in debugging. @@ -145,7 +145,7 @@ func (b *Buffer) WriteString(s string) (n int, err error) { } // MinRead is the minimum slice size passed to a Read call by -// Buffer.ReadFrom. As long as the Buffer has at least MinRead bytes beyond +// Buffer.ReadFrom. As long as the Buffer has at least MinRead bytes beyond // what is required to hold the contents of r, ReadFrom will not grow the // underlying buffer. const MinRead = 512 @@ -252,7 +252,7 @@ func (b *Buffer) WriteRune(r rune) (n int, err error) { } // Read reads the next len(p) bytes from the buffer or until the buffer -// is drained. The return value n is the number of bytes read. If the +// is drained. The return value n is the number of bytes read. If the // buffer has no data to return, err is io.EOF (unless len(p) is zero); // otherwise it is nil. func (b *Buffer) Read(p []byte) (n int, err error) { @@ -347,7 +347,7 @@ func (b *Buffer) UnreadRune() error { } // UnreadByte unreads the last byte returned by the most recent -// read operation. If write has happened since the last read, UnreadByte +// read operation. If write has happened since the last read, UnreadByte // returns an error. func (b *Buffer) UnreadByte() error { if b.lastRead != opReadRune && b.lastRead != opRead { @@ -400,7 +400,7 @@ func (b *Buffer) ReadString(delim byte) (line string, err error) { } // NewBuffer creates and initializes a new Buffer using buf as its initial -// contents. It is intended to prepare a Buffer to read existing data. It +// contents. It is intended to prepare a Buffer to read existing data. It // can also be used to size the internal buffer for writing. To do that, // buf should have the desired capacity but a length of zero. // diff --git a/src/bytes/bytes.go b/src/bytes/bytes.go index b86824087e..8a4409cb6b 100644 --- a/src/bytes/bytes.go +++ b/src/bytes/bytes.go @@ -164,7 +164,7 @@ func IndexRune(s []byte, r rune) int { // IndexAny interprets s as a sequence of UTF-8-encoded Unicode code points. // It returns the byte index of the first occurrence in s of any of the Unicode -// code points in chars. It returns -1 if chars is empty or if there is no code +// code points in chars. It returns -1 if chars is empty or if there is no code // point in common. func IndexAny(s []byte, chars string) int { if len(chars) > 0 { @@ -188,8 +188,8 @@ func IndexAny(s []byte, chars string) int { } // LastIndexAny interprets s as a sequence of UTF-8-encoded Unicode code -// points. It returns the byte index of the last occurrence in s of any of -// the Unicode code points in chars. It returns -1 if chars is empty or if +// points. It returns the byte index of the last occurrence in s of any of +// the Unicode code points in chars. It returns -1 if chars is empty or if // there is no code point in common. func LastIndexAny(s []byte, chars string) int { if len(chars) > 0 { @@ -276,7 +276,7 @@ func Fields(s []byte) [][]byte { // FieldsFunc interprets s as a sequence of UTF-8-encoded Unicode code points. // It splits the slice s at each run of code points c satisfying f(c) and -// returns a slice of subslices of s. If all code points in s satisfy f(c), or +// returns a slice of subslices of s. If all code points in s satisfy f(c), or // len(s) == 0, an empty slice is returned. // FieldsFunc makes no guarantees about the order in which it calls f(c). // If f does not return consistent results for a given c, FieldsFunc may crash. @@ -352,12 +352,12 @@ func HasSuffix(s, suffix []byte) bool { // Map returns a copy of the byte slice s with all its characters modified // according to the mapping function. If mapping returns a negative value, the character is -// dropped from the string with no replacement. The characters in s and the +// dropped from the string with no replacement. The characters in s and the // output are interpreted as UTF-8-encoded Unicode code points. func Map(mapping func(r rune) rune, s []byte) []byte { // In the worst case, the slice can grow when mapped, making - // things unpleasant. But it's so rare we barge in assuming it's - // fine. It could also shrink but that falls out naturally. + // things unpleasant. But it's so rare we barge in assuming it's + // fine. It could also shrink but that falls out naturally. maxbytes := len(s) // length of b nbytes := 0 // number of bytes encoded in b b := make([]byte, maxbytes) @@ -697,7 +697,7 @@ func EqualFold(s, t []byte) bool { return false } - // General case. SimpleFold(x) returns the next equivalent rune > x + // General case. SimpleFold(x) returns the next equivalent rune > x // or wraps around to smaller values. r := unicode.SimpleFold(sr) for r != sr && r < tr { @@ -709,6 +709,6 @@ func EqualFold(s, t []byte) bool { return false } - // One string is empty. Are both? + // One string is empty. Are both? return len(s) == len(t) } diff --git a/src/bytes/bytes_test.go b/src/bytes/bytes_test.go index a412dc89b9..f158098f9b 100644 --- a/src/bytes/bytes_test.go +++ b/src/bytes/bytes_test.go @@ -113,7 +113,7 @@ func TestEqualExhaustive(t *testing.T) { } } -// make sure Equal returns false for minimally different strings. The data +// make sure Equal returns false for minimally different strings. The data // is all zeros except for a single one in one location. func TestNotEqual(t *testing.T) { var size = 128 @@ -797,7 +797,7 @@ func TestMap(t *testing.T) { // Run a couple of awful growth/shrinkage tests a := tenRunes('a') - // 1. Grow. This triggers two reallocations in Map. + // 1. Grow. This triggers two reallocations in Map. maxRune := func(r rune) rune { return unicode.MaxRune } m := Map(maxRune, []byte(a)) expect := tenRunes(unicode.MaxRune) diff --git a/src/bytes/compare_test.go b/src/bytes/compare_test.go index f2d81d5310..35088a1b2e 100644 --- a/src/bytes/compare_test.go +++ b/src/bytes/compare_test.go @@ -62,7 +62,7 @@ func TestCompareBytes(t *testing.T) { a := make([]byte, n+1) b := make([]byte, n+1) for len := 0; len < 128; len++ { - // randomish but deterministic data. No 0 or 255. + // randomish but deterministic data. No 0 or 255. for i := 0; i < len; i++ { a[i] = byte(1 + 31*i%254) b[i] = byte(1 + 31*i%254) diff --git a/src/bytes/equal_test.go b/src/bytes/equal_test.go index 1bf19a74b8..9fdead8a60 100644 --- a/src/bytes/equal_test.go +++ b/src/bytes/equal_test.go @@ -14,11 +14,11 @@ import ( ) // This file tests the situation where memeq is checking -// data very near to a page boundary. We want to make sure +// data very near to a page boundary. We want to make sure // equal does not read across the boundary and cause a page // fault where it shouldn't. -// This test runs only on linux. The code being tested is +// This test runs only on linux. The code being tested is // not OS-specific, so it does not need to be tested on all // operating systems. -- cgit v1.3-5-g9baa