@@ -209,6 +209,7 @@ func (c *Config) getPackageConfigMap(ctx context.Context, packageName string) (m
209
209
if isMap {
210
210
return configAsMap , nil
211
211
}
212
+
212
213
return map [string ]any {}, nil
213
214
214
215
}
@@ -430,21 +431,21 @@ func (c *Config) addSubPkgConfig(ctx context.Context, subPkgPath string, parentP
430
431
Str ("parent-package" , parentPkgPath ).
431
432
Str ("sub-package" , subPkgPath ).Logger ()
432
433
433
- log .Trace ().Msg ("adding sub-package to config map" )
434
+ log .Debug ().Msg ("adding sub-package to config map" )
434
435
parentPkgConfig , err := c .getPackageConfigMap (ctx , parentPkgPath )
435
436
if err != nil {
436
437
log .Err (err ).
437
438
Msg ("failed to get package config for parent package" )
438
439
return fmt .Errorf ("failed to get package config: %w" , err )
439
440
}
440
441
441
- log .Trace ().Msg ("getting config" )
442
+ log .Debug ().Msg ("getting config" )
442
443
cfg , err := c .CfgAsMap (ctx )
443
444
if err != nil {
444
445
return fmt .Errorf ("failed to get configuration map: %w" , err )
445
446
}
446
447
447
- log .Trace ().Msg ("getting packages section" )
448
+ log .Debug ().Msg ("getting packages section" )
448
449
packagesSection := cfg ["packages" ].(map [string ]any )
449
450
450
451
// Don't overwrite any config that already exists
@@ -688,15 +689,21 @@ func (c *Config) mergeInConfig(ctx context.Context) error {
688
689
packageConfig ["config" ] = defaultCfg
689
690
continue
690
691
}
691
- packageConfigSection := configSectionUntyped .(map [string ]any )
692
+ // Sometimes the config section may be provided, but it's nil.
693
+ // We need to account for this fact.
694
+ if configSectionUntyped == nil {
695
+ configSectionUntyped = map [string ]any {}
696
+ }
697
+
698
+ configSectionTyped := configSectionUntyped .(map [string ]any )
692
699
693
700
for key , value := range defaultCfg {
694
701
if contains ([]string {"packages" , "config" }, key ) {
695
702
continue
696
703
}
697
- _ , keyExists := packageConfigSection [key ]
704
+ _ , keyExists := configSectionTyped [key ]
698
705
if ! keyExists {
699
- packageConfigSection [key ] = value
706
+ configSectionTyped [key ] = value
700
707
}
701
708
}
702
709
interfaces , err := c .getInterfacesForPackage (ctx , pkgPath )
@@ -728,7 +735,7 @@ func (c *Config) mergeInConfig(ctx context.Context) error {
728
735
// Assume this interface's value in the map is nil. Just skip it.
729
736
continue
730
737
}
731
- for key , value := range packageConfigSection {
738
+ for key , value := range configSectionTyped {
732
739
if key == "packages" {
733
740
continue
734
741
}
0 commit comments