diff options
Diffstat (limited to 'libgo/go/bytes/buffer.go')
-rw-r--r-- | libgo/go/bytes/buffer.go | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/libgo/go/bytes/buffer.go b/libgo/go/bytes/buffer.go index aff2db5..f19a4cf 100644 --- a/libgo/go/bytes/buffer.go +++ b/libgo/go/bytes/buffer.go @@ -21,9 +21,6 @@ type Buffer struct { buf []byte // contents are the bytes buf[off : len(buf)] off int // read at &buf[off], write at &buf[len(buf)] lastRead readOp // last read operation, so that Unread* can work correctly. - - // FIXME: it would be advisable to align Buffer to cachelines to avoid false - // sharing. } // The readOp constants describe the last action performed on @@ -385,13 +382,15 @@ func (b *Buffer) UnreadRune() error { return nil } +var errUnreadByte = errors.New("bytes.Buffer: UnreadByte: previous operation was not a successful read") + // UnreadByte unreads the last byte returned by the most recent successful // read operation that read at least one byte. If a write has happened since // the last read, if the last read returned an error, or if the read read zero // bytes, UnreadByte returns an error. func (b *Buffer) UnreadByte() error { if b.lastRead == opInvalid { - return errors.New("bytes.Buffer: UnreadByte: previous operation was not a successful read") + return errUnreadByte } b.lastRead = opInvalid if b.off > 0 { |