Before this commit, the code declares and assigns "n" with the result of
io.ReadFull() -- but the value is not used. The variable is then reused
later in the function.
This commit removes the first declaration of "n" and declares it closer
to where it is used.
Change-Id: I7ffe19a10f2a563c306bb6fe6562493435b9dc5a
Reviewed-on: https://go-review.googlesource.com/c/go/+/232917
Reviewed-by: Rob Pike <r@golang.org>
func (d *decoder) parseChunk() error {
// Read the length and chunk type.
- n, err := io.ReadFull(d.r, d.tmp[:8])
- if err != nil {
+ if _, err := io.ReadFull(d.r, d.tmp[:8]); err != nil {
return err
}
length := binary.BigEndian.Uint32(d.tmp[:4])
// Ignore this chunk (of a known length).
var ignored [4096]byte
for length > 0 {
- n, err = io.ReadFull(d.r, ignored[:min(len(ignored), int(length))])
+ n, err := io.ReadFull(d.r, ignored[:min(len(ignored), int(length))])
if err != nil {
return err
}