mirror of
https://github.com/restic/restic.git
synced 2025-12-03 22:01:46 +00:00
errcheck: Add error checks
Most added checks are straight forward.
This commit is contained in:
@@ -229,7 +229,10 @@ func updateSnapshots(ctx context.Context, root *Root) error {
|
||||
|
||||
if root.snCount != len(snapshots) {
|
||||
root.snCount = len(snapshots)
|
||||
root.repo.LoadIndex(ctx)
|
||||
err := root.repo.LoadIndex(ctx)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
root.snapshots = snapshots
|
||||
}
|
||||
root.lastCheck = time.Now()
|
||||
@@ -272,7 +275,10 @@ func (d *SnapshotsDir) ReadDirAll(ctx context.Context) ([]fuse.Dirent, error) {
|
||||
debug.Log("ReadDirAll()")
|
||||
|
||||
// update snapshots
|
||||
updateSnapshots(ctx, d.root)
|
||||
err := updateSnapshots(ctx, d.root)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// update snapshot names
|
||||
updateSnapshotNames(d, d.root.cfg.SnapshotTemplate)
|
||||
@@ -314,7 +320,10 @@ func (d *SnapshotsIDSDir) ReadDirAll(ctx context.Context) ([]fuse.Dirent, error)
|
||||
debug.Log("ReadDirAll()")
|
||||
|
||||
// update snapshots
|
||||
updateSnapshots(ctx, d.root)
|
||||
err := updateSnapshots(ctx, d.root)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// update snapshot ids
|
||||
updateSnapshotIDSNames(d)
|
||||
@@ -348,7 +357,10 @@ func (d *HostsDir) ReadDirAll(ctx context.Context) ([]fuse.Dirent, error) {
|
||||
debug.Log("ReadDirAll()")
|
||||
|
||||
// update snapshots
|
||||
updateSnapshots(ctx, d.root)
|
||||
err := updateSnapshots(ctx, d.root)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// update host names
|
||||
updateHostsNames(d)
|
||||
@@ -382,7 +394,10 @@ func (d *TagsDir) ReadDirAll(ctx context.Context) ([]fuse.Dirent, error) {
|
||||
debug.Log("ReadDirAll()")
|
||||
|
||||
// update snapshots
|
||||
updateSnapshots(ctx, d.root)
|
||||
err := updateSnapshots(ctx, d.root)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// update tag names
|
||||
updateTagNames(d)
|
||||
@@ -443,7 +458,10 @@ func (d *SnapshotsDir) Lookup(ctx context.Context, name string) (fs.Node, error)
|
||||
sn, ok := d.names[name]
|
||||
if !ok {
|
||||
// could not find entry. Updating repository-state
|
||||
updateSnapshots(ctx, d.root)
|
||||
err := updateSnapshots(ctx, d.root)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// update snapshot names
|
||||
updateSnapshotNames(d, d.root.cfg.SnapshotTemplate)
|
||||
@@ -476,7 +494,10 @@ func (d *SnapshotsIDSDir) Lookup(ctx context.Context, name string) (fs.Node, err
|
||||
sn, ok := d.names[name]
|
||||
if !ok {
|
||||
// could not find entry. Updating repository-state
|
||||
updateSnapshots(ctx, d.root)
|
||||
err := updateSnapshots(ctx, d.root)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// update snapshot ids
|
||||
updateSnapshotIDSNames(d)
|
||||
@@ -499,7 +520,10 @@ func (d *HostsDir) Lookup(ctx context.Context, name string) (fs.Node, error) {
|
||||
_, ok := d.hosts[name]
|
||||
if !ok {
|
||||
// could not find entry. Updating repository-state
|
||||
updateSnapshots(ctx, d.root)
|
||||
err := updateSnapshots(ctx, d.root)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// update host names
|
||||
updateHostsNames(d)
|
||||
@@ -522,7 +546,10 @@ func (d *TagsDir) Lookup(ctx context.Context, name string) (fs.Node, error) {
|
||||
_, ok := d.tags[name]
|
||||
if !ok {
|
||||
// could not find entry. Updating repository-state
|
||||
updateSnapshots(ctx, d.root)
|
||||
err := updateSnapshots(ctx, d.root)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// update tag names
|
||||
updateTagNames(d)
|
||||
|
||||
Reference in New Issue
Block a user