@@ -41,7 +41,7 @@ func New() (*ConfigHandler, error) {
41
41
}
42
42
43
43
// AddConfig adds a configuration parameter to both Cobra and Viper with options
44
- func (c * ConfigHandler ) AddConfig (cmd * cobra.Command , opts ConfigOptions ) error {
44
+ func (c * ConfigHandler ) AddConfig (cmd * cobra.Command , opts ConfigOptions ) {
45
45
key := opts .Key
46
46
defaultValue := opts .DefaultValue
47
47
// Set default value in Viper
@@ -66,12 +66,12 @@ func (c *ConfigHandler) AddConfig(cmd *cobra.Command, opts ConfigOptions) error
66
66
case []string :
67
67
flagSet .StringSlice (flagName , defaultValue .([]string ), opts .Description )
68
68
default :
69
- return fmt .Errorf ("unsupported type for key %s" , key )
69
+ panic ( fmt .Errorf ("unsupported type for key %s" , key ) )
70
70
}
71
71
72
72
// Bind the flag to Viper
73
73
if err := c .v .BindPFlag (key , flagSet .Lookup (flagName )); err != nil {
74
- return fmt .Errorf ("failed to bind %s: %w" , key , err )
74
+ panic ( fmt .Errorf ("failed to bind %s: %w" , key , err ) )
75
75
}
76
76
77
77
// Handle environment variable binding
@@ -85,7 +85,7 @@ func (c *ConfigHandler) AddConfig(cmd *cobra.Command, opts ConfigOptions) error
85
85
}
86
86
}
87
87
88
- return nil
88
+ return
89
89
}
90
90
91
91
// load reads and merges the configuration
0 commit comments