From e7576e085c31a7b9187460b476fbe990a39192d5 Mon Sep 17 00:00:00 2001 From: Tomas Aparicio Date: Sun, 12 Apr 2015 17:43:11 +0200 Subject: [PATCH] refactor(file) --- file.go | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) diff --git a/file.go b/file.go index b6c5b04..e84fb7a 100644 --- a/file.go +++ b/file.go @@ -1,23 +1,9 @@ package bimg -import ( - "io/ioutil" - "os" -) +import "io/ioutil" func Read(path string) ([]byte, error) { - file, err := os.Open(path) - if err != nil { - return nil, err - } - defer file.Close() - - buf, err := ioutil.ReadAll(file) - if err != nil { - return nil, err - } - - return buf, nil + return ioutil.ReadFile(path) } func Write(path string, buf []byte) error {