diff --git a/envconf.go b/envconf.go index 5521d0c..07629c3 100644 --- a/envconf.go +++ b/envconf.go @@ -62,7 +62,7 @@ func NewConfig() *Config { config.mapMapMapEnv[left] = make(map[string]map[string]map[string]string) } config.mapEnv[left][right] = key - if count < len(splitted)-2 { + if count < len(splitted)-1 { middle := splitted[count] right = strings.Join(splitted[count+1:], "_") if len(config.mapMapEnv[left][middle]) == 0 { @@ -70,7 +70,7 @@ func NewConfig() *Config { config.mapMapMapEnv[left][middle] = make(map[string]map[string]string) } config.mapMapEnv[left][middle][right] = key - if count < len(splitted)-3 { + if count < len(splitted)-2 { lmiddle := splitted[count] rmiddle := splitted[count+1] right = strings.Join(splitted[count+2:], "_") diff --git a/tests/main.go b/tests/main.go index f45d84c..a48b310 100644 --- a/tests/main.go +++ b/tests/main.go @@ -11,7 +11,6 @@ func main() { conf.DefineMap("test_map", envconf.TypeInt) conf.Parse() conf.Status() - fmt.Println(conf) - fmt.Println(conf.GetMapInt("test_map")) + fmt.Println(conf.GetMapMapInt("test_map")) fmt.Println(conf.GetInt("this_is_a_map")) }