From bcd4168428df6e292d3b7ed9476feac1b44ceacf Mon Sep 17 00:00:00 2001 From: Winfried Plappert <18740761+wplapper@users.noreply.github.com> Date: Sat, 31 Jan 2026 22:04:01 +0000 Subject: [PATCH] Enhancement: calls to SnapshotFilter.FindLatest() can be simplified (#5688) --- cmd/restic/cmd_dump.go | 6 +----- cmd/restic/cmd_ls.go | 6 +----- cmd/restic/cmd_restore.go | 6 +----- 3 files changed, 3 insertions(+), 15 deletions(-) diff --git a/cmd/restic/cmd_dump.go b/cmd/restic/cmd_dump.go index abea6e52e..6a5e3adb6 100644 --- a/cmd/restic/cmd_dump.go +++ b/cmd/restic/cmd_dump.go @@ -157,11 +157,7 @@ func runDump(ctx context.Context, opts DumpOptions, gopts global.Options, args [ } defer unlock() - sn, subfolder, err := (&data.SnapshotFilter{ - Hosts: opts.Hosts, - Paths: opts.Paths, - Tags: opts.Tags, - }).FindLatest(ctx, repo, repo, snapshotIDString) + sn, subfolder, err := opts.SnapshotFilter.FindLatest(ctx, repo, repo, snapshotIDString) if err != nil { return errors.Fatalf("failed to find snapshot: %v", err) } diff --git a/cmd/restic/cmd_ls.go b/cmd/restic/cmd_ls.go index 8e45c50a1..92e3abfcc 100644 --- a/cmd/restic/cmd_ls.go +++ b/cmd/restic/cmd_ls.go @@ -406,11 +406,7 @@ func runLs(ctx context.Context, opts LsOptions, gopts global.Options, args []str } } - sn, subfolder, err := (&data.SnapshotFilter{ - Hosts: opts.Hosts, - Paths: opts.Paths, - Tags: opts.Tags, - }).FindLatest(ctx, snapshotLister, repo, args[0]) + sn, subfolder, err := opts.SnapshotFilter.FindLatest(ctx, snapshotLister, repo, args[0]) if err != nil { return err } diff --git a/cmd/restic/cmd_restore.go b/cmd/restic/cmd_restore.go index 49b72c3f9..76a0044da 100644 --- a/cmd/restic/cmd_restore.go +++ b/cmd/restic/cmd_restore.go @@ -151,11 +151,7 @@ func runRestore(ctx context.Context, opts RestoreOptions, gopts global.Options, } defer unlock() - sn, subfolder, err := (&data.SnapshotFilter{ - Hosts: opts.Hosts, - Paths: opts.Paths, - Tags: opts.Tags, - }).FindLatest(ctx, repo, repo, snapshotIDString) + sn, subfolder, err := opts.SnapshotFilter.FindLatest(ctx, repo, repo, snapshotIDString) if err != nil { return errors.Fatalf("failed to find snapshot: %v", err) }