From b8da487f774aa2399b79bbde5f2e6e13be4fce1c Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 17 May 2024 10:51:42 +0200 Subject: feat: decode brotli-compressed files --- internal/importer/options.go | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) (limited to 'internal/importer/options.go') diff --git a/internal/importer/options.go b/internal/importer/options.go index ec2c20f..0aadc50 100644 --- a/internal/importer/options.go +++ b/internal/importer/options.go @@ -2,8 +2,8 @@ package importer import ( "context" + "io" "log/slog" - "os" "reflect" "searchix/internal/config" "searchix/internal/nix" @@ -58,15 +58,11 @@ type OptionIngester struct { dec *jstream.Decoder ms *mapstructure.Decoder optJSON nixOptionJSON - infile *os.File + infile io.ReadCloser source *config.Source } -func NewOptionProcessor(inpath string, source *config.Source) (*OptionIngester, error) { - infile, err := os.Open(inpath) - if err != nil { - return nil, errors.WithMessagef(err, "failed to open input file %s", inpath) - } +func NewOptionProcessor(infile io.ReadCloser, source *config.Source) (*OptionIngester, error) { i := OptionIngester{ dec: jstream.NewDecoder(infile, 1).EmitKV(), optJSON: nixOptionJSON{}, -- cgit 1.4.1