From 446fc256e634fab8d7c4c965d068be30158f16be Mon Sep 17 00:00:00 2001 From: Dingjun Date: Fri, 26 Aug 2016 11:06:25 +0800 Subject: [PATCH] use ioutil.ReadFile instead of Open/ReadAll --- cfg.go | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/cfg.go b/cfg.go index 1daedcd..b07d0c5 100644 --- a/cfg.go +++ b/cfg.go @@ -57,13 +57,11 @@ type cfg struct { } func parseCfg(fn string) (*cfg, error) { - fp, err := os.Open(fn) + c := cfg{} + buf, err := ioutil.ReadFile(fn) if err != nil { return nil, err } - defer fp.Close() - c := cfg{} - buf, err := ioutil.ReadAll(fp) err = json.Unmarshal(buf, &c) if err != nil { return nil, err