refactor: pass options struct to fetcher.New
1 file changed, 8 insertions(+), 4 deletions(-)
changed files
M internal/fetcher/main.go → internal/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()) }