diff options
author | Alan Pearce | 2024-05-17 10:51:42 +0200 |
---|---|---|
committer | Alan Pearce | 2024-05-17 12:21:19 +0200 |
commit | b8da487f774aa2399b79bbde5f2e6e13be4fce1c (patch) | |
tree | ff3379ea1ac598a025f7e70ccc6c7fc3d0b44434 /internal/importer/main.go | |
parent | 27b07a80f1872205dfeb949e9b90cf85f6e43744 (diff) | |
download | searchix-b8da487f774aa2399b79bbde5f2e6e13be4fce1c.tar.lz searchix-b8da487f774aa2399b79bbde5f2e6e13be4fce1c.tar.zst searchix-b8da487f774aa2399b79bbde5f2e6e13be4fce1c.zip |
feat: decode brotli-compressed files
Diffstat (limited to 'internal/importer/main.go')
-rw-r--r-- | internal/importer/main.go | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/internal/importer/main.go b/internal/importer/main.go index d2b66e1..7776482 100644 --- a/internal/importer/main.go +++ b/internal/importer/main.go @@ -2,6 +2,7 @@ package importer import ( "context" + "io" "log/slog" "os/exec" "path" @@ -59,6 +60,7 @@ func Start(cfg *config.Config, indexer *index.WriteIndex, replace bool) error { logger.Warn("could not set source repo revision", "error", err) } + var file io.ReadCloser var processor Processor switch source.Importer { case config.Options: @@ -69,7 +71,11 @@ func Start(cfg *config.Config, indexer *index.WriteIndex, replace bool) error { "revision", source.Repo.Revision, ) - processor, err = NewOptionProcessor(files.Options, source) + file, err = openFileDecoded(files.Options) + if err != nil { + logger.Warn("could not open file", "filename", files.Options, "error", err) + } + processor, err = NewOptionProcessor(file, source) case config.Packages: logger.Debug( "creating processor", @@ -78,7 +84,11 @@ func Start(cfg *config.Config, indexer *index.WriteIndex, replace bool) error { "revision", source.Repo.Revision, ) - processor, err = NewPackageProcessor(files.Packages, source) + file, err = openFileDecoded(files.Packages) + if err != nil { + logger.Warn("could not open file", "filename", files.Packages, "error", err) + } + processor, err = NewPackageProcessor(file, source) } if err != nil { logger.Warn("failed to create processor", "type", source.Importer, "error", err) |