summaryrefslogtreecommitdiff
path: root/src/pkg/bytes/buffer.go
diff options
context:
space:
mode:
authorRobert Griesemer <gri@golang.org>2009-11-06 14:24:38 -0800
committerRobert Griesemer <gri@golang.org>2009-11-06 14:24:38 -0800
commit828334dd95ce8e4bf3662bd5c89d7c417f0741d0 (patch)
treefd7e0c9961bc3af2ddf105e9cc1943f2509ac584 /src/pkg/bytes/buffer.go
parenteb5cdfd67ff6d32df4c4c27840eaee027c5e3512 (diff)
downloadgolang-828334dd95ce8e4bf3662bd5c89d7c417f0741d0.tar.gz
- fine-tuning of one-line func heuristic (nodes.go)
- enabled for function declarations (not just function literals) - applied gofmt -w $GOROOT/src (look for instance at src/pkg/debug/elf/elf.go) R=r, rsc CC=go-dev http://go/go-review/1026006
Diffstat (limited to 'src/pkg/bytes/buffer.go')
-rw-r--r--src/pkg/bytes/buffer.go16
1 files changed, 4 insertions, 12 deletions
diff --git a/src/pkg/bytes/buffer.go b/src/pkg/bytes/buffer.go
index 875086525..a448dff84 100644
--- a/src/pkg/bytes/buffer.go
+++ b/src/pkg/bytes/buffer.go
@@ -37,9 +37,7 @@ type Buffer struct {
// Bytes returns the contents of the unread portion of the buffer;
// len(b.Bytes()) == b.Len().
-func (b *Buffer) Bytes() []byte {
- return b.buf[b.off : len(b.buf)];
-}
+func (b *Buffer) Bytes() []byte { return b.buf[b.off : len(b.buf)] }
// String returns the contents of the unread portion of the buffer
// as a string. If the Buffer is a nil pointer, it returns "<nil>".
@@ -53,9 +51,7 @@ func (b *Buffer) String() string {
// Len returns the number of bytes of the unread portion of the buffer;
// b.Len() == len(b.Bytes()).
-func (b *Buffer) Len() int {
- return len(b.buf) - b.off;
-}
+func (b *Buffer) Len() int { return len(b.buf) - b.off }
// Truncate discards all but the first n unread bytes from the buffer.
// It is an error to call b.Truncate(n) with n > b.Len().
@@ -69,9 +65,7 @@ func (b *Buffer) Truncate(n int) {
// Reset resets the buffer so it has no content.
// b.Reset() is the same as b.Truncate(0).
-func (b *Buffer) Reset() {
- b.Truncate(0);
-}
+func (b *Buffer) Reset() { b.Truncate(0) }
// Write appends the contents of p to the buffer. The return
// value n is the length of p; err is always nil.
@@ -166,9 +160,7 @@ func (b *Buffer) ReadByte() (c byte, err os.Error) {
// NewBuffer creates and initializes a new Buffer
// using buf as its initial contents.
-func NewBuffer(buf []byte) *Buffer {
- return &Buffer{buf: buf};
-}
+func NewBuffer(buf []byte) *Buffer { return &Buffer{buf: buf} }
// NewBufferString creates and initializes a new Buffer
// using string s as its initial contents.