From eece37e0ad6ab050ff52b98efc573b7c036ed751 Mon Sep 17 00:00:00 2001 From: qbart Date: Fri, 3 Dec 2021 02:35:26 +0100 Subject: [PATCH] Init defaults for Action --- krab/config.go | 3 +++ krab/type_action.go | 7 +++++++ 2 files changed, 10 insertions(+) diff --git a/krab/config.go b/krab/config.go index 7c132d6..fb8409d 100644 --- a/krab/config.go +++ b/krab/config.go @@ -52,6 +52,9 @@ func NewConfig(files []*File) (*Config, error) { for _, defaultable := range c.MigrationSets { defaultable.InitDefaults() } + for _, defaultable := range c.Actions { + defaultable.InitDefaults() + } // validate for _, validatable := range c.MigrationSets { diff --git a/krab/type_action.go b/krab/type_action.go index 9a55e5a..8d0a7d0 100644 --- a/krab/type_action.go +++ b/krab/type_action.go @@ -19,6 +19,13 @@ func (a *Action) Addr() Addr { return Addr{Keyword: "action", Labels: []string{a.Namespace, a.RefName}} } +func (a *Action) InitDefaults() { + if a.Arguments == nil { + a.Arguments = &Arguments{} + } + a.Arguments.InitDefaults() +} + func (a *Action) Validate() error { return ErrorCoalesce( ValidateRefName(a.Namespace),