forked from TrueCloudLab/restic
Fix coding style
This commit is contained in:
parent
e654a9659c
commit
a016f82051
2 changed files with 13 additions and 16 deletions
|
@ -59,13 +59,11 @@ func (cmd CmdMount) Execute(args []string) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
mountpoint := args[0]
|
mountpoint := args[0]
|
||||||
if _, err := os.Stat(mountpoint); err != nil {
|
if _, err := os.Stat(mountpoint); os.IsNotExist(err) {
|
||||||
if os.IsNotExist(err) {
|
cmd.global.Verbosef("Mountpoint %s doesn't exist, creating it\n", mountpoint)
|
||||||
cmd.global.Verbosef("Mountpoint %s doesn't exist, creating it\n", mountpoint)
|
err = os.Mkdir(mountpoint, os.ModeDir|0700)
|
||||||
err = os.Mkdir(mountpoint, os.ModeDir|0700)
|
if err != nil {
|
||||||
if err != nil {
|
return err
|
||||||
return err
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
c, err := fuse.Mount(
|
c, err := fuse.Mount(
|
||||||
|
@ -83,8 +81,8 @@ func (cmd CmdMount) Execute(args []string) error {
|
||||||
knownSnapshots: make(map[string]snapshotWithId),
|
knownSnapshots: make(map[string]snapshotWithId),
|
||||||
})
|
})
|
||||||
|
|
||||||
cmd.global.Printf("Now serving %s under %s\n", repo.Backend().Location(), mountpoint)
|
cmd.global.Printf("Now serving %s at %s\n", repo.Backend().Location(), mountpoint)
|
||||||
cmd.global.Printf("Don't forget to umount after quitting !\n")
|
cmd.global.Printf("Don't forget to umount after quitting!\n")
|
||||||
|
|
||||||
cmd.ready <- struct{}{}
|
cmd.ready <- struct{}{}
|
||||||
|
|
||||||
|
@ -116,9 +114,9 @@ type snapshots struct {
|
||||||
knownSnapshots map[string]snapshotWithId
|
knownSnapshots map[string]snapshotWithId
|
||||||
}
|
}
|
||||||
|
|
||||||
func (sn *snapshots) Attr(ctx context.Context, a *fuse.Attr) error {
|
func (sn *snapshots) Attr(ctx context.Context, attr *fuse.Attr) error {
|
||||||
a.Inode = 0
|
attr.Inode = 0
|
||||||
a.Mode = os.ModeDir | 0555
|
attr.Mode = os.ModeDir | 0555
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -247,7 +245,6 @@ func (d *dir) Lookup(ctx context.Context, name string) (fs.Node, error) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil, fuse.ENOENT
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Statically ensure that *file implements the given interface
|
// Statically ensure that *file implements the given interface
|
||||||
|
@ -265,8 +262,8 @@ type file struct {
|
||||||
|
|
||||||
func makeFile(repo *repository.Repository, node *restic.Node) (*file, error) {
|
func makeFile(repo *repository.Repository, node *restic.Node) (*file, error) {
|
||||||
sizes := make([]uint32, len(node.Content))
|
sizes := make([]uint32, len(node.Content))
|
||||||
for i, bid := range node.Content {
|
for i, blobId := range node.Content {
|
||||||
_, _, _, length, err := repo.Index().Lookup(bid)
|
_, _, _, length, err := repo.Index().Lookup(blobId)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,7 +34,7 @@ func TestMount(t *testing.T) {
|
||||||
OK(t, err)
|
OK(t, err)
|
||||||
Assert(t,
|
Assert(t,
|
||||||
namesInSnapshots[i] == snapshot.Time.Format(time.RFC3339),
|
namesInSnapshots[i] == snapshot.Time.Format(time.RFC3339),
|
||||||
"Invalid snapshot folder name: expected %s, got %s", snapshot.Time.Format(time.RFC3339), namesInSnapshots[i])
|
"Invalid snapshot directory name: expected %s, got %s", snapshot.Time.Format(time.RFC3339), namesInSnapshots[i])
|
||||||
}
|
}
|
||||||
OK(t, stSnapshots.Close())
|
OK(t, stSnapshots.Close())
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue