config ini module when set section is not exist will panic!
Showing
1 changed file
with
3 additions
and
0 deletions
| ... | @@ -162,6 +162,9 @@ func (c *IniConfigContainer) Set(key, value string) error { | ... | @@ -162,6 +162,9 @@ func (c *IniConfigContainer) Set(key, value string) error { |
| 162 | section = DEFAULT_SECTION | 162 | section = DEFAULT_SECTION |
| 163 | k = sectionkey[0] | 163 | k = sectionkey[0] |
| 164 | } | 164 | } |
| 165 | if _, ok := c.data[section]; !ok { | ||
| 166 | c.data[section] = make(map[string]string) | ||
| 167 | } | ||
| 165 | c.data[section][k] = value | 168 | c.data[section][k] = value |
| 166 | return nil | 169 | return nil |
| 167 | } | 170 | } | ... | ... |
-
Please register or sign in to post a comment