all repos — searchix @ 0ae74e5f6af61819e8f954960287ea14ec447834

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

refactor: pass options struct to fetcher.New

Alan Pearce
commit

0ae74e5f6af61819e8f954960287ea14ec447834

parent

4f1db3ca3ae4d7a522834aca55cd619bb4798f5f

1 file changed, 8 insertions(+), 4 deletions(-)

changed files
M internal/fetcher/main.gointernal/fetcher/main.go
@@ -10,6 +10,10 @@ "alin.ovh/x/log"
"github.com/Southclaws/fault" ) +type Options struct { + Logger *log.Logger +} + type FetchedFiles struct { Revision io.ReadCloser Options io.ReadCloser
@@ -22,15 +26,15 @@ }
func New( source *config.Source, - logger *log.Logger, + opts *Options, ) (fetcher Fetcher, err error) { switch source.Fetcher { case config.ChannelNixpkgs: - fetcher, err = NewNixpkgsChannelFetcher(source, logger) + fetcher, err = NewNixpkgsChannelFetcher(source, opts.Logger) case config.Channel: - fetcher, err = NewChannelFetcher(source, logger) + fetcher, err = NewChannelFetcher(source, opts.Logger) case config.Download: - fetcher, err = NewDownloadFetcher(source, logger) + fetcher, err = NewDownloadFetcher(source, opts.Logger) default: err = fault.Newf("unsupported fetcher type %s", source.Fetcher.String()) }