Skip to content

Commit

Permalink
fix nil error in extension cmd
Browse files Browse the repository at this point in the history
  • Loading branch information
pomdtr committed Dec 13, 2023
1 parent 1550dfd commit b433d90
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions internal/cli/extension.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import (
func NewCmdExtension(cfg config.Config) *cobra.Command {
cmd := &cobra.Command{
Use: "extension",
Aliases: []string{"ext"},
Short: "Manage sunbeam extensions",
GroupID: CommandGroupCore,
}
Expand Down
7 changes: 6 additions & 1 deletion internal/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,12 @@ func Load(configPath string) (Config, error) {
return Config{}, fmt.Errorf("invalid config: %w", err)
}

var config Config
// set default values for configs
config := Config{
Oneliners: make(map[string]Oneliner),
Extensions: make(map[string]ExtensionConfig),
}

if err := json.Unmarshal(configBytes, &config); err != nil {
return Config{}, fmt.Errorf("failed to unmarshal config: %w", err)
}
Expand Down

0 comments on commit b433d90

Please sign in to comment.