From 606370479fbf0e315ccffcea8d86126c4a0c9db2 Mon Sep 17 00:00:00 2001 From: "Santiago M. Mola" Date: Wed, 30 Nov 2016 17:04:29 +0100 Subject: file: return error on File.Contents() if reader fails (#150) --- file.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/file.go b/file.go index c5a6d42..e735723 100644 --- a/file.go +++ b/file.go @@ -30,7 +30,9 @@ func (f *File) Contents() (content string, err error) { defer checkClose(reader, &err) buf := new(bytes.Buffer) - buf.ReadFrom(reader) + if _, err := buf.ReadFrom(reader); err != nil { + return "", err + } return buf.String(), nil } -- cgit