mirror of
https://github.com/gopasspw/gopass.git
synced 2025-12-08 19:24:54 +00:00
* [chore] Migrate to golangci-lint v2 Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org> * [chore] Fix more lint issues Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org> * [chore] Fix more lint issue Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org> * [chore] Fix more lint issues Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org> * [chore] Add more package comments. Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org> * [chore] Fix golangci-lint config and the remaining checks Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org> * [fix] Use Go 1.24 Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org> * [fix] Fix container builds Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org> * Fix more failing tests Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org> * Fix test failure Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org> * Fix another len assertion Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org> * Move location tests Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org> * [fix] Fix most remaining lint issues Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org> * [fix] Only run XDG specific tests on linux Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org> * [fix] Attempt to address on source of flaky failures Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org> --------- Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>
53 lines
1.0 KiB
Go
53 lines
1.0 KiB
Go
package root
|
|
|
|
import (
|
|
"context"
|
|
"errors"
|
|
"strings"
|
|
|
|
"github.com/gopasspw/gopass/internal/out"
|
|
"github.com/gopasspw/gopass/pkg/debug"
|
|
)
|
|
|
|
// Fsck checks all stores/entries matching the given prefix.
|
|
func (r *Store) Fsck(ctx context.Context, store, path string) error {
|
|
var result []error
|
|
|
|
for alias, sub := range r.mounts {
|
|
if sub == nil {
|
|
continue
|
|
}
|
|
|
|
if store != "" && alias != store {
|
|
continue
|
|
}
|
|
|
|
if path != "" && !strings.HasPrefix(path, alias+"/") {
|
|
continue
|
|
}
|
|
|
|
path = strings.TrimPrefix(path, alias+"/")
|
|
|
|
// check sub store
|
|
debug.Log("Checking mount point %s", alias)
|
|
|
|
if err := sub.Fsck(ctx, path); err != nil {
|
|
out.Errorf(ctx, "fsck failed on sub store %s: %s", alias, err)
|
|
result = append(result, err)
|
|
}
|
|
|
|
debug.Log("Checked mount point %s", alias)
|
|
}
|
|
|
|
// check root store
|
|
debug.Log("Checking root store")
|
|
if err := r.store.Fsck(ctx, path); err != nil {
|
|
out.Errorf(ctx, "fsck failed on root store: %s", err)
|
|
result = append(result, err)
|
|
}
|
|
|
|
debug.Log("Checked root store")
|
|
|
|
return errors.Join(result...)
|
|
}
|