Skip to content

Commit 276a8e9

Browse files
committed
fix: load
1 parent a08648a commit 276a8e9

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

pkg/config/load.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"io"
55
"os"
66

7+
"github.com/creasty/defaults"
78
"github.com/sdsc-ordes/quitsh/pkg/errors"
89

910
"github.com/goccy/go-yaml"
@@ -24,10 +25,16 @@ type (
2425
)
2526

2627
// LoadFromReader loads a config file from reader `reader`.
28+
// It initializes the `conf` with `defaults.Set`.
2729
func LoadFromReader[T any, TP LoadIniter[T]](
2830
reader io.Reader,
2931
opts ...LoadOption,
3032
) (conf T, err error) {
33+
err = defaults.Set(&conf)
34+
if err != nil {
35+
return
36+
}
37+
3138
err = LoadFromReaderInto[T, TP](reader, &conf, opts...)
3239

3340
return

0 commit comments

Comments
 (0)