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/options.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/options.go')
-rw-r--r-- | internal/importer/options.go | 10 |
1 files changed, 3 insertions, 7 deletions
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{}, |