fix nil map

This commit is contained in:
Roy Olav Purser 2022-01-15 18:52:45 +01:00
parent 7b77ef35af
commit 712f3b65cf
Signed by: roypur
GPG Key ID: E14D26A036F21656

View File

@ -84,8 +84,8 @@ func (c *Config) Define(key string, dtype DataType) {
// Define the type of an environment variable. // Define the type of an environment variable.
// Variables without a defined type will be ignored by Parse. // Variables without a defined type will be ignored by Parse.
func (c *Config) DefineMap(key string, dtype DataType) { func (c *Config) DefineMap(key string, dtype DataType) {
upper := strings.ToUpper(key) key = cleanKey(key)
entries, ok := c.mapEnv[upper] entries, ok := c.mapEnv[key]
if ok { if ok {
for mapKey, entry := range entries { for mapKey, entry := range entries {
entry.dtype = dtype entry.dtype = dtype