change map offset

This commit is contained in:
Roy Olav Purser 2022-03-27 14:32:28 +02:00
parent 4520530b7f
commit 3c23ee5473
Signed by: roypur
GPG Key ID: E14D26A036F21656
2 changed files with 3 additions and 4 deletions

View File

@ -62,7 +62,7 @@ func NewConfig() *Config {
config.mapMapMapEnv[left] = make(map[string]map[string]map[string]string) config.mapMapMapEnv[left] = make(map[string]map[string]map[string]string)
} }
config.mapEnv[left][right] = key config.mapEnv[left][right] = key
if count < len(splitted)-2 { if count < len(splitted)-1 {
middle := splitted[count] middle := splitted[count]
right = strings.Join(splitted[count+1:], "_") right = strings.Join(splitted[count+1:], "_")
if len(config.mapMapEnv[left][middle]) == 0 { 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.mapMapMapEnv[left][middle] = make(map[string]map[string]string)
} }
config.mapMapEnv[left][middle][right] = key config.mapMapEnv[left][middle][right] = key
if count < len(splitted)-3 { if count < len(splitted)-2 {
lmiddle := splitted[count] lmiddle := splitted[count]
rmiddle := splitted[count+1] rmiddle := splitted[count+1]
right = strings.Join(splitted[count+2:], "_") right = strings.Join(splitted[count+2:], "_")

View File

@ -11,7 +11,6 @@ func main() {
conf.DefineMap("test_map", envconf.TypeInt) conf.DefineMap("test_map", envconf.TypeInt)
conf.Parse() conf.Parse()
conf.Status() conf.Status()
fmt.Println(conf) fmt.Println(conf.GetMapMapInt("test_map"))
fmt.Println(conf.GetMapInt("test_map"))
fmt.Println(conf.GetInt("this_is_a_map")) fmt.Println(conf.GetInt("this_is_a_map"))
} }