diff --git a/pkg/gotemplate/new.go b/pkg/gotemplate/new.go index d6f24802..40c7a1f3 100644 --- a/pkg/gotemplate/new.go +++ b/pkg/gotemplate/new.go @@ -167,7 +167,7 @@ func (gt *GT) LoadConfigValuesInteractively() (*OptionValues, error) { func (gt *GT) loadOptionValueInteractively(option *Option, optionValues *OptionValues) interface{} { if !option.ShouldDisplay(optionValues) { - return nil + return option.Default(optionValues) } val, err := gt.readOptionValue(option, optionValues) diff --git a/pkg/gotemplate/new_test.go b/pkg/gotemplate/new_test.go index a0605b3a..cfe43e7e 100644 --- a/pkg/gotemplate/new_test.go +++ b/pkg/gotemplate/new_test.go @@ -424,7 +424,8 @@ func TestGT_LoadConfigValuesInteractively(t *testing.T) { optionValues, err := gt.LoadConfigValuesInteractively() require.NoError(t, err) - require.Equal(t, len(optionValues.Base), 0) + // the default value should be used in the optionValues in case there are dependent options + require.Equal(t, len(optionValues.Base), 1) require.NotContains(t, out.String(), dependentOptionName) })