From 01d49dc2ddda443f302be8ca0aa1378d550687ef Mon Sep 17 00:00:00 2001 From: Rui Ueyama Date: Mon, 17 Mar 2014 12:07:30 -0700 Subject: [PATCH] encoding/hex: add error check for write error. I believe the original author of this code just forgot to check for error here. LGTM=bradfitz R=golang-codereviews, bradfitz CC=golang-codereviews https://golang.org/cl/76760043 --- src/pkg/encoding/hex/hex.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/pkg/encoding/hex/hex.go b/src/pkg/encoding/hex/hex.go index 167d00e032..d1fc7024a9 100644 --- a/src/pkg/encoding/hex/hex.go +++ b/src/pkg/encoding/hex/hex.go @@ -146,6 +146,9 @@ func (h *dumper) Write(data []byte) (n int, err error) { h.buf[12] = ' ' h.buf[13] = ' ' _, err = h.w.Write(h.buf[4:]) + if err != nil { + return + } } Encode(h.buf[:], data[i:i+1]) h.buf[2] = ' '