From f733b5707a9b746b5aa1201f0bef316c8890f15c Mon Sep 17 00:00:00 2001 From: fuxiaohei Date: Thu, 17 Jul 2014 15:49:40 +0800 Subject: [PATCH] code style simplify --- config/json.go | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/config/json.go b/config/json.go index dbab41b0..97e4c2f9 100644 --- a/config/json.go +++ b/config/json.go @@ -145,12 +145,14 @@ func (c *JsonConfigContainer) getdata(key string) interface{} { } sectionKey := strings.Split(key, "::") if len(sectionKey) >= 2 { - if curValue, ok := c.data[sectionKey[0]]; ok { - for _, key := range sectionKey[1:] { - if v, ok := curValue.(map[string]interface{}); ok { - if v2, ok := v[key]; ok { - return v2 - } + curValue, ok := c.data[sectionKey[0]] + if !ok { + return nil + } + for _, key := range sectionKey[1:] { + if v, ok := curValue.(map[string]interface{}); ok { + if v2, ok := v[key]; ok { + return v2 } } }