about summary refs log tree commit diff stats
path: root/internal/fetcher/main.go
diff options
context:
space:
mode:
authorAlan Pearce2024-05-20 23:55:40 +0200
committerAlan Pearce2024-05-20 23:55:40 +0200
commitb77a24f9f75378ffe97be83cf4dfd7f1683b9a7e (patch)
tree5e5efa81a76b8e3349c522729b98bb0d106f3bce /internal/fetcher/main.go
parentc821da1cf55864852bcd8f337dd7acd0cc02f0b9 (diff)
downloadsearchix-b77a24f9f75378ffe97be83cf4dfd7f1683b9a7e.tar.lz
searchix-b77a24f9f75378ffe97be83cf4dfd7f1683b9a7e.tar.zst
searchix-b77a24f9f75378ffe97be83cf4dfd7f1683b9a7e.zip
fix: make fetcher check on creation that it supports Source.Importer
Diffstat (limited to 'internal/fetcher/main.go')
-rw-r--r--internal/fetcher/main.go42
1 files changed, 3 insertions, 39 deletions
diff --git a/internal/fetcher/main.go b/internal/fetcher/main.go
index d8bc25e..65f62db 100644
--- a/internal/fetcher/main.go
+++ b/internal/fetcher/main.go
@@ -18,42 +18,6 @@ type Fetcher interface {
 	FetchIfNeeded(context.Context) (FetchedFiles, bool, error)
 }
 
-func NewNixpkgsChannelFetcher(
-	source *config.Source,
-	dataPath string,
-	logger *slog.Logger,
-) *NixpkgsChannelFetcher {
-	return &NixpkgsChannelFetcher{
-		DataPath: dataPath,
-		Source:   source,
-		Logger:   logger,
-	}
-}
-
-func NewChannelFetcher(
-	source *config.Source,
-	dataPath string,
-	logger *slog.Logger,
-) *ChannelFetcher {
-	return &ChannelFetcher{
-		DataPath: dataPath,
-		Source:   source,
-		Logger:   logger,
-	}
-}
-
-func NewDownloadFetcher(
-	source *config.Source,
-	dataPath string,
-	logger *slog.Logger,
-) *DownloadFetcher {
-	return &DownloadFetcher{
-		DataPath: dataPath,
-		Source:   source,
-		Logger:   logger,
-	}
-}
-
 func New(
 	source *config.Source,
 	fetcherDataPath string,
@@ -61,11 +25,11 @@ func New(
 ) (fetcher Fetcher, err error) {
 	switch source.Fetcher {
 	case config.ChannelNixpkgs:
-		fetcher = NewNixpkgsChannelFetcher(source, fetcherDataPath, logger)
+		fetcher, err = NewNixpkgsChannelFetcher(source, fetcherDataPath, logger)
 	case config.Channel:
-		fetcher = NewChannelFetcher(source, fetcherDataPath, logger)
+		fetcher, err = NewChannelFetcher(source, fetcherDataPath, logger)
 	case config.Download:
-		fetcher = NewDownloadFetcher(source, fetcherDataPath, logger)
+		fetcher, err = NewDownloadFetcher(source, fetcherDataPath, logger)
 	default:
 		err = errors.Errorf("unsupported fetcher type %s", source.Fetcher.String())
 	}