all repos — searchix @ 0e24d9cde2f9a9e94315fa463d6503ddd64255c2

Search engine for NixOS, nix-darwin, home-manager and NUR users

refactor: reduce use of pointers in particular, Source can no longer be nil. Instantiate a Source with an Importer of All instead

Alan Pearce
commit

0e24d9cde2f9a9e94315fa463d6503ddd64255c2

parent

05838942b9468dd1efb6d295a206730fa82264c0

1 file changed, 5 insertions(+), 5 deletions(-)

changed files
M internal/config/config.gointernal/config/config.go
@@ -25,7 +25,7 @@ type URL struct {
*url.URL } -func (u *URL) MarshalText() ([]byte, error) { +func (u URL) MarshalText() ([]byte, error) { return []byte(u.String()), nil }
@@ -52,7 +52,7 @@ type Duration struct {
time.Duration } -func (d *Duration) MarshalText() ([]byte, error) { +func (d Duration) MarshalText() ([]byte, error) { return []byte(d.String()), nil }
@@ -80,7 +80,7 @@ type LocalTime struct {
toml.LocalTime } -func (t *LocalTime) MarshalText() ([]byte, error) { +func (t LocalTime) MarshalText() ([]byte, error) { b, err := t.LocalTime.MarshalText() if err != nil { return nil, fault.Wrap(err, fmsg.With("could not marshal time value"))
@@ -145,7 +145,7 @@ config.Web.ContentSecurityPolicy.ScriptSrc,
config.Web.BaseURL.String(), ) - maps.DeleteFunc(config.Importer.Sources, func(_ string, v *Source) bool { + maps.DeleteFunc(config.Importer.Sources, func(_ string, v Source) bool { return !v.Enable })
@@ -153,7 +153,7 @@ for k, v := range config.Importer.Sources {
if v.Key == "" { v.Key = k } - if err := defaults.Set(v); err != nil { + if err := defaults.Set(&v); err != nil { return nil, fault.Wrap(err, fmsg.With("setting defaults failed")) } }