diff --git a/context/context.go b/context/context.go index 24f81142c..236f9e722 100644 --- a/context/context.go +++ b/context/context.go @@ -165,10 +165,7 @@ func (c *fsContext) Config() (config.Config, error) { if c.config == nil { cfg, err := config.ParseDefaultConfig() if errors.Is(err, os.ErrNotExist) { - cfg, err = config.InitDefaultConfig() - if err != nil { - return nil, fmt.Errorf("could not create default config: %w", err) - } + cfg = config.NewBlankConfig() } else if err != nil { return nil, err } diff --git a/internal/config/config_type.go b/internal/config/config_type.go index 7f98341b3..a57d21dec 100644 --- a/internal/config/config_type.go +++ b/internal/config/config_type.go @@ -122,8 +122,8 @@ func NewConfig(root *yaml.Node) Config { } } -func InitDefaultConfig() (Config, error) { - cfg := NewConfig(&yaml.Node{ +func NewBlankConfig() Config { + return NewConfig(&yaml.Node{ Kind: yaml.DocumentNode, Content: []*yaml.Node{ { @@ -169,21 +169,6 @@ func InitDefaultConfig() (Config, error) { }, }, }) - - err := cfg.Write() - if err != nil { - return nil, err - } - - return cfg, nil - -} - -func NewBlankConfig() Config { - return NewConfig(&yaml.Node{ - Kind: yaml.DocumentNode, - Content: []*yaml.Node{{Kind: yaml.MappingNode}}, - }) } // This type implements a Config interface and represents a config file on disk.