From 351c15f1cee364a91ef606ef9114d55247a6a0c2 Mon Sep 17 00:00:00 2001 From: Brad Fitzpatrick Date: Sun, 28 Feb 2016 15:52:49 -0800 Subject: all: remove public named return values when useless Named returned values should only be used on public funcs and methods when it contributes to the documentation. Named return values should not be used if they're only saving the programmer a few lines of code inside the body of the function, especially if that means there's stutter in the documentation or it was only there so the programmer could use a naked return statement. (Naked returns should not be used except in very small functions) This change is a manual audit & cleanup of public func signatures. Signatures were not changed if: * the func was private (wouldn't be in public godoc) * the documentation referenced it * the named return value was an interesting name. (i.e. it wasn't simply stutter, repeating the name of the type) There should be no changes in behavior. (At least: none intended) Change-Id: I3472ef49619678fe786e5e0994bdf2d9de76d109 Reviewed-on: https://go-review.googlesource.com/20024 Run-TryBot: Brad Fitzpatrick TryBot-Result: Gobot Gobot Reviewed-by: Andrew Gerrand --- src/bytes/buffer.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/bytes/buffer.go') diff --git a/src/bytes/buffer.go b/src/bytes/buffer.go index f135b46959..1aed86924d 100644 --- a/src/bytes/buffer.go +++ b/src/bytes/buffer.go @@ -293,14 +293,14 @@ func (b *Buffer) Next(n int) []byte { // ReadByte reads and returns the next byte from the buffer. // If no byte is available, it returns error io.EOF. -func (b *Buffer) ReadByte() (c byte, err error) { +func (b *Buffer) ReadByte() (byte, error) { b.lastRead = opInvalid if b.off >= len(b.buf) { // Buffer is empty, reset to recover space. b.Truncate(0) return 0, io.EOF } - c = b.buf[b.off] + c := b.buf[b.off] b.off++ b.lastRead = opRead return c, nil -- cgit v1.3