all repos — searchix @ 1d518f42e04712c84dfc168cc7a286aabb56e2ed

Search engine for NixOS, nix-darwin, home-manager and NUR users

feat: limit file operations using os.Root

Alan Pearce
commit

1d518f42e04712c84dfc168cc7a286aabb56e2ed

parent

dec2c516100350a78f0b7116bc6f9d76325e7760

1 file changed, 10 insertions(+), 2 deletions(-)

changed files
M internal/importer/main_test.gointernal/importer/main_test.go
@@ -5,6 +5,7 @@ "context"
"testing" "alin.ovh/searchix/internal/config" + "alin.ovh/searchix/internal/file" "alin.ovh/searchix/internal/index" "alin.ovh/searchix/internal/manpages" "alin.ovh/x/log"
@@ -13,7 +14,11 @@
var cfg = config.DefaultConfig func BenchmarkImporterLowMemory(b *testing.B) { - tmp := b.TempDir() + tmp, err := file.OpenRoot(b.TempDir()) + if err != nil { + b.Fatal(err) + } + logger := log.Configure(false) _, write, _, err := index.OpenOrCreate(tmp, false, &index.Options{ LowMemory: true,
@@ -28,7 +33,10 @@ imp, err := New(&cfg, &Options{
Logger: logger.Named("importer"), LowMemory: true, WriteIndex: write, - Manpages: manpages.New(&cfg, logger.Named("manpages")), + Manpages: manpages.New(&manpages.Options{ + Logger: logger.Named("manpages"), + Root: tmp, + }), }) if err != nil { b.Fatal(err)