diff options
| author | ewy <ewy0@protonmail.com> | 2026-04-14 18:58:37 +0200 |
|---|---|---|
| committer | ewy <ewy0@protonmail.com> | 2026-04-14 18:58:37 +0200 |
| commit | 370f13b58e9cb74eeab3461afb779cf4d013c94b (patch) | |
| tree | b030d70528cd390818254839c1f140a5a575f191 /model/new.go | |
| parent | 4fecdd952c270de8ce6e4cc4e6f3513e5579febe (diff) | |
handle not having stuff installed a little more gracefully
Diffstat (limited to 'model/new.go')
| -rw-r--r-- | model/new.go | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/model/new.go b/model/new.go index f26bc8f..41086c2 100644 --- a/model/new.go +++ b/model/new.go @@ -7,7 +7,8 @@ import ( "strings" ) -func NewState(f fs.FS, locations []string, indexers []Indexer, runners []Runner) (*State, error) { +func NewState(f fs.FS, locations []string, indexers []Indexer, runners []Runner) (*State, []error) { + var errs []error st := &State{} for _, loc := range locations { _, dirName := filepath.Split(loc) @@ -26,11 +27,13 @@ func NewState(f fs.FS, locations []string, indexers []Indexer, runners []Runner) s, err := fs.Sub(f, loc) if err != nil { - return nil, err + errs = append(errs, err) + continue } targets, err := indexer.Index("/"+loc, s, runners) if err != nil { - return nil, err + errs = append(errs, err) + continue } src.Targets = append(src.Targets, targets...) } @@ -41,5 +44,5 @@ func NewState(f fs.FS, locations []string, indexers []Indexer, runners []Runner) } - return st, nil + return st, errs } |
