mirror of
https://github.com/octoleo/restic.git
synced 2024-11-25 22:27:35 +00:00
Remove a few redundant type specifiers
This is the result of running `gofmt -s -w **/*.go`
This commit is contained in:
parent
cfd57c480a
commit
efbb850d92
@ -33,15 +33,15 @@ func TestScanner(t *testing.T) {
|
||||
},
|
||||
},
|
||||
want: map[string]ScanStats{
|
||||
filepath.FromSlash("other"): ScanStats{Files: 1, Bytes: 12},
|
||||
filepath.FromSlash("work/foo"): ScanStats{Files: 2, Bytes: 15},
|
||||
filepath.FromSlash("work/foo.txt"): ScanStats{Files: 3, Bytes: 28},
|
||||
filepath.FromSlash("work/subdir/bar.txt"): ScanStats{Files: 4, Bytes: 45},
|
||||
filepath.FromSlash("work/subdir/other"): ScanStats{Files: 5, Bytes: 60},
|
||||
filepath.FromSlash("work/subdir"): ScanStats{Files: 5, Dirs: 1, Bytes: 60},
|
||||
filepath.FromSlash("work"): ScanStats{Files: 5, Dirs: 2, Bytes: 60},
|
||||
filepath.FromSlash("."): ScanStats{Files: 5, Dirs: 3, Bytes: 60},
|
||||
filepath.FromSlash(""): ScanStats{Files: 5, Dirs: 3, Bytes: 60},
|
||||
filepath.FromSlash("other"): {Files: 1, Bytes: 12},
|
||||
filepath.FromSlash("work/foo"): {Files: 2, Bytes: 15},
|
||||
filepath.FromSlash("work/foo.txt"): {Files: 3, Bytes: 28},
|
||||
filepath.FromSlash("work/subdir/bar.txt"): {Files: 4, Bytes: 45},
|
||||
filepath.FromSlash("work/subdir/other"): {Files: 5, Bytes: 60},
|
||||
filepath.FromSlash("work/subdir"): {Files: 5, Dirs: 1, Bytes: 60},
|
||||
filepath.FromSlash("work"): {Files: 5, Dirs: 2, Bytes: 60},
|
||||
filepath.FromSlash("."): {Files: 5, Dirs: 3, Bytes: 60},
|
||||
filepath.FromSlash(""): {Files: 5, Dirs: 3, Bytes: 60},
|
||||
},
|
||||
},
|
||||
{
|
||||
@ -68,12 +68,12 @@ func TestScanner(t *testing.T) {
|
||||
return false
|
||||
},
|
||||
want: map[string]ScanStats{
|
||||
filepath.FromSlash("work/foo.txt"): ScanStats{Files: 1, Bytes: 13},
|
||||
filepath.FromSlash("work/subdir/bar.txt"): ScanStats{Files: 2, Bytes: 30},
|
||||
filepath.FromSlash("work/subdir"): ScanStats{Files: 2, Dirs: 1, Bytes: 30},
|
||||
filepath.FromSlash("work"): ScanStats{Files: 2, Dirs: 2, Bytes: 30},
|
||||
filepath.FromSlash("."): ScanStats{Files: 2, Dirs: 3, Bytes: 30},
|
||||
filepath.FromSlash(""): ScanStats{Files: 2, Dirs: 3, Bytes: 30},
|
||||
filepath.FromSlash("work/foo.txt"): {Files: 1, Bytes: 13},
|
||||
filepath.FromSlash("work/subdir/bar.txt"): {Files: 2, Bytes: 30},
|
||||
filepath.FromSlash("work/subdir"): {Files: 2, Dirs: 1, Bytes: 30},
|
||||
filepath.FromSlash("work"): {Files: 2, Dirs: 2, Bytes: 30},
|
||||
filepath.FromSlash("."): {Files: 2, Dirs: 3, Bytes: 30},
|
||||
filepath.FromSlash(""): {Files: 2, Dirs: 3, Bytes: 30},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
@ -150,34 +150,34 @@ func TestTree(t *testing.T) {
|
||||
{
|
||||
targets: []string{"foo"},
|
||||
want: Tree{Nodes: map[string]Tree{
|
||||
"foo": Tree{Path: "foo", Root: "."},
|
||||
"foo": {Path: "foo", Root: "."},
|
||||
}},
|
||||
},
|
||||
{
|
||||
targets: []string{"foo", "bar", "baz"},
|
||||
want: Tree{Nodes: map[string]Tree{
|
||||
"foo": Tree{Path: "foo", Root: "."},
|
||||
"bar": Tree{Path: "bar", Root: "."},
|
||||
"baz": Tree{Path: "baz", Root: "."},
|
||||
"foo": {Path: "foo", Root: "."},
|
||||
"bar": {Path: "bar", Root: "."},
|
||||
"baz": {Path: "baz", Root: "."},
|
||||
}},
|
||||
},
|
||||
{
|
||||
targets: []string{"foo/user1", "foo/user2", "foo/other"},
|
||||
want: Tree{Nodes: map[string]Tree{
|
||||
"foo": Tree{Root: ".", FileInfoPath: "foo", Nodes: map[string]Tree{
|
||||
"user1": Tree{Path: filepath.FromSlash("foo/user1")},
|
||||
"user2": Tree{Path: filepath.FromSlash("foo/user2")},
|
||||
"other": Tree{Path: filepath.FromSlash("foo/other")},
|
||||
"foo": {Root: ".", FileInfoPath: "foo", Nodes: map[string]Tree{
|
||||
"user1": {Path: filepath.FromSlash("foo/user1")},
|
||||
"user2": {Path: filepath.FromSlash("foo/user2")},
|
||||
"other": {Path: filepath.FromSlash("foo/other")},
|
||||
}},
|
||||
}},
|
||||
},
|
||||
{
|
||||
targets: []string{"foo/work/user1", "foo/work/user2"},
|
||||
want: Tree{Nodes: map[string]Tree{
|
||||
"foo": Tree{Root: ".", FileInfoPath: "foo", Nodes: map[string]Tree{
|
||||
"work": Tree{FileInfoPath: filepath.FromSlash("foo/work"), Nodes: map[string]Tree{
|
||||
"user1": Tree{Path: filepath.FromSlash("foo/work/user1")},
|
||||
"user2": Tree{Path: filepath.FromSlash("foo/work/user2")},
|
||||
"foo": {Root: ".", FileInfoPath: "foo", Nodes: map[string]Tree{
|
||||
"work": {FileInfoPath: filepath.FromSlash("foo/work"), Nodes: map[string]Tree{
|
||||
"user1": {Path: filepath.FromSlash("foo/work/user1")},
|
||||
"user2": {Path: filepath.FromSlash("foo/work/user2")},
|
||||
}},
|
||||
}},
|
||||
}},
|
||||
@ -185,50 +185,50 @@ func TestTree(t *testing.T) {
|
||||
{
|
||||
targets: []string{"foo/user1", "bar/user1", "foo/other"},
|
||||
want: Tree{Nodes: map[string]Tree{
|
||||
"foo": Tree{Root: ".", FileInfoPath: "foo", Nodes: map[string]Tree{
|
||||
"user1": Tree{Path: filepath.FromSlash("foo/user1")},
|
||||
"other": Tree{Path: filepath.FromSlash("foo/other")},
|
||||
"foo": {Root: ".", FileInfoPath: "foo", Nodes: map[string]Tree{
|
||||
"user1": {Path: filepath.FromSlash("foo/user1")},
|
||||
"other": {Path: filepath.FromSlash("foo/other")},
|
||||
}},
|
||||
"bar": Tree{Root: ".", FileInfoPath: "bar", Nodes: map[string]Tree{
|
||||
"user1": Tree{Path: filepath.FromSlash("bar/user1")},
|
||||
"bar": {Root: ".", FileInfoPath: "bar", Nodes: map[string]Tree{
|
||||
"user1": {Path: filepath.FromSlash("bar/user1")},
|
||||
}},
|
||||
}},
|
||||
},
|
||||
{
|
||||
targets: []string{"../work"},
|
||||
want: Tree{Nodes: map[string]Tree{
|
||||
"work": Tree{Root: "..", Path: filepath.FromSlash("../work")},
|
||||
"work": {Root: "..", Path: filepath.FromSlash("../work")},
|
||||
}},
|
||||
},
|
||||
{
|
||||
targets: []string{"../work/other"},
|
||||
want: Tree{Nodes: map[string]Tree{
|
||||
"work": Tree{Root: "..", FileInfoPath: filepath.FromSlash("../work"), Nodes: map[string]Tree{
|
||||
"other": Tree{Path: filepath.FromSlash("../work/other")},
|
||||
"work": {Root: "..", FileInfoPath: filepath.FromSlash("../work"), Nodes: map[string]Tree{
|
||||
"other": {Path: filepath.FromSlash("../work/other")},
|
||||
}},
|
||||
}},
|
||||
},
|
||||
{
|
||||
targets: []string{"foo/user1", "../work/other", "foo/user2"},
|
||||
want: Tree{Nodes: map[string]Tree{
|
||||
"foo": Tree{Root: ".", FileInfoPath: "foo", Nodes: map[string]Tree{
|
||||
"user1": Tree{Path: filepath.FromSlash("foo/user1")},
|
||||
"user2": Tree{Path: filepath.FromSlash("foo/user2")},
|
||||
"foo": {Root: ".", FileInfoPath: "foo", Nodes: map[string]Tree{
|
||||
"user1": {Path: filepath.FromSlash("foo/user1")},
|
||||
"user2": {Path: filepath.FromSlash("foo/user2")},
|
||||
}},
|
||||
"work": Tree{Root: "..", FileInfoPath: filepath.FromSlash("../work"), Nodes: map[string]Tree{
|
||||
"other": Tree{Path: filepath.FromSlash("../work/other")},
|
||||
"work": {Root: "..", FileInfoPath: filepath.FromSlash("../work"), Nodes: map[string]Tree{
|
||||
"other": {Path: filepath.FromSlash("../work/other")},
|
||||
}},
|
||||
}},
|
||||
},
|
||||
{
|
||||
targets: []string{"foo/user1", "../foo/other", "foo/user2"},
|
||||
want: Tree{Nodes: map[string]Tree{
|
||||
"foo": Tree{Root: ".", FileInfoPath: "foo", Nodes: map[string]Tree{
|
||||
"user1": Tree{Path: filepath.FromSlash("foo/user1")},
|
||||
"user2": Tree{Path: filepath.FromSlash("foo/user2")},
|
||||
"foo": {Root: ".", FileInfoPath: "foo", Nodes: map[string]Tree{
|
||||
"user1": {Path: filepath.FromSlash("foo/user1")},
|
||||
"user2": {Path: filepath.FromSlash("foo/user2")},
|
||||
}},
|
||||
"foo-1": Tree{Root: "..", FileInfoPath: filepath.FromSlash("../foo"), Nodes: map[string]Tree{
|
||||
"other": Tree{Path: filepath.FromSlash("../foo/other")},
|
||||
"foo-1": {Root: "..", FileInfoPath: filepath.FromSlash("../foo"), Nodes: map[string]Tree{
|
||||
"other": {Path: filepath.FromSlash("../foo/other")},
|
||||
}},
|
||||
}},
|
||||
},
|
||||
@ -241,12 +241,12 @@ func TestTree(t *testing.T) {
|
||||
},
|
||||
targets: []string{"foo", "foo/work"},
|
||||
want: Tree{Nodes: map[string]Tree{
|
||||
"foo": Tree{
|
||||
"foo": {
|
||||
Root: ".",
|
||||
FileInfoPath: "foo",
|
||||
Nodes: map[string]Tree{
|
||||
"file": Tree{Path: filepath.FromSlash("foo/file")},
|
||||
"work": Tree{Path: filepath.FromSlash("foo/work")},
|
||||
"file": {Path: filepath.FromSlash("foo/file")},
|
||||
"work": {Path: filepath.FromSlash("foo/work")},
|
||||
},
|
||||
},
|
||||
}},
|
||||
@ -262,12 +262,12 @@ func TestTree(t *testing.T) {
|
||||
},
|
||||
targets: []string{"foo/work", "foo"},
|
||||
want: Tree{Nodes: map[string]Tree{
|
||||
"foo": Tree{
|
||||
"foo": {
|
||||
Root: ".",
|
||||
FileInfoPath: "foo",
|
||||
Nodes: map[string]Tree{
|
||||
"file": Tree{Path: filepath.FromSlash("foo/file")},
|
||||
"work": Tree{Path: filepath.FromSlash("foo/work")},
|
||||
"file": {Path: filepath.FromSlash("foo/file")},
|
||||
"work": {Path: filepath.FromSlash("foo/work")},
|
||||
},
|
||||
},
|
||||
}},
|
||||
@ -283,12 +283,12 @@ func TestTree(t *testing.T) {
|
||||
},
|
||||
targets: []string{"foo/work", "foo/work/user2"},
|
||||
want: Tree{Nodes: map[string]Tree{
|
||||
"foo": Tree{Root: ".", FileInfoPath: "foo", Nodes: map[string]Tree{
|
||||
"work": Tree{
|
||||
"foo": {Root: ".", FileInfoPath: "foo", Nodes: map[string]Tree{
|
||||
"work": {
|
||||
FileInfoPath: filepath.FromSlash("foo/work"),
|
||||
Nodes: map[string]Tree{
|
||||
"user1": Tree{Path: filepath.FromSlash("foo/work/user1")},
|
||||
"user2": Tree{Path: filepath.FromSlash("foo/work/user2")},
|
||||
"user1": {Path: filepath.FromSlash("foo/work/user1")},
|
||||
"user2": {Path: filepath.FromSlash("foo/work/user2")},
|
||||
},
|
||||
},
|
||||
}},
|
||||
@ -305,11 +305,11 @@ func TestTree(t *testing.T) {
|
||||
},
|
||||
targets: []string{"foo/work/user2", "foo/work"},
|
||||
want: Tree{Nodes: map[string]Tree{
|
||||
"foo": Tree{Root: ".", FileInfoPath: "foo", Nodes: map[string]Tree{
|
||||
"work": Tree{FileInfoPath: filepath.FromSlash("foo/work"),
|
||||
"foo": {Root: ".", FileInfoPath: "foo", Nodes: map[string]Tree{
|
||||
"work": {FileInfoPath: filepath.FromSlash("foo/work"),
|
||||
Nodes: map[string]Tree{
|
||||
"user1": Tree{Path: filepath.FromSlash("foo/work/user1")},
|
||||
"user2": Tree{Path: filepath.FromSlash("foo/work/user2")},
|
||||
"user1": {Path: filepath.FromSlash("foo/work/user1")},
|
||||
"user2": {Path: filepath.FromSlash("foo/work/user2")},
|
||||
},
|
||||
},
|
||||
}},
|
||||
@ -333,17 +333,17 @@ func TestTree(t *testing.T) {
|
||||
},
|
||||
targets: []string{"foo/work/user2/data/secret", "foo"},
|
||||
want: Tree{Nodes: map[string]Tree{
|
||||
"foo": Tree{Root: ".", FileInfoPath: "foo", Nodes: map[string]Tree{
|
||||
"other": Tree{Path: filepath.FromSlash("foo/other")},
|
||||
"work": Tree{FileInfoPath: filepath.FromSlash("foo/work"), Nodes: map[string]Tree{
|
||||
"user2": Tree{FileInfoPath: filepath.FromSlash("foo/work/user2"), Nodes: map[string]Tree{
|
||||
"data": Tree{FileInfoPath: filepath.FromSlash("foo/work/user2/data"), Nodes: map[string]Tree{
|
||||
"secret": Tree{
|
||||
"foo": {Root: ".", FileInfoPath: "foo", Nodes: map[string]Tree{
|
||||
"other": {Path: filepath.FromSlash("foo/other")},
|
||||
"work": {FileInfoPath: filepath.FromSlash("foo/work"), Nodes: map[string]Tree{
|
||||
"user2": {FileInfoPath: filepath.FromSlash("foo/work/user2"), Nodes: map[string]Tree{
|
||||
"data": {FileInfoPath: filepath.FromSlash("foo/work/user2/data"), Nodes: map[string]Tree{
|
||||
"secret": {
|
||||
Path: filepath.FromSlash("foo/work/user2/data/secret"),
|
||||
},
|
||||
}},
|
||||
}},
|
||||
"user3": Tree{Path: filepath.FromSlash("foo/work/user3")},
|
||||
"user3": {Path: filepath.FromSlash("foo/work/user3")},
|
||||
}},
|
||||
}},
|
||||
}},
|
||||
@ -369,15 +369,15 @@ func TestTree(t *testing.T) {
|
||||
unix: true,
|
||||
targets: []string{"mnt/driveA", "mnt/driveA/work/driveB"},
|
||||
want: Tree{Nodes: map[string]Tree{
|
||||
"mnt": Tree{Root: ".", FileInfoPath: filepath.FromSlash("mnt"), Nodes: map[string]Tree{
|
||||
"driveA": Tree{FileInfoPath: filepath.FromSlash("mnt/driveA"), Nodes: map[string]Tree{
|
||||
"work": Tree{FileInfoPath: filepath.FromSlash("mnt/driveA/work"), Nodes: map[string]Tree{
|
||||
"driveB": Tree{
|
||||
"mnt": {Root: ".", FileInfoPath: filepath.FromSlash("mnt"), Nodes: map[string]Tree{
|
||||
"driveA": {FileInfoPath: filepath.FromSlash("mnt/driveA"), Nodes: map[string]Tree{
|
||||
"work": {FileInfoPath: filepath.FromSlash("mnt/driveA/work"), Nodes: map[string]Tree{
|
||||
"driveB": {
|
||||
Path: filepath.FromSlash("mnt/driveA/work/driveB"),
|
||||
},
|
||||
"test1": Tree{Path: filepath.FromSlash("mnt/driveA/work/test1")},
|
||||
"test1": {Path: filepath.FromSlash("mnt/driveA/work/test1")},
|
||||
}},
|
||||
"test2": Tree{Path: filepath.FromSlash("mnt/driveA/test2")},
|
||||
"test2": {Path: filepath.FromSlash("mnt/driveA/test2")},
|
||||
}},
|
||||
}},
|
||||
}},
|
||||
@ -385,9 +385,9 @@ func TestTree(t *testing.T) {
|
||||
{
|
||||
targets: []string{"foo/work/user", "foo/work/user"},
|
||||
want: Tree{Nodes: map[string]Tree{
|
||||
"foo": Tree{Root: ".", FileInfoPath: "foo", Nodes: map[string]Tree{
|
||||
"work": Tree{FileInfoPath: filepath.FromSlash("foo/work"), Nodes: map[string]Tree{
|
||||
"user": Tree{Path: filepath.FromSlash("foo/work/user")},
|
||||
"foo": {Root: ".", FileInfoPath: "foo", Nodes: map[string]Tree{
|
||||
"work": {FileInfoPath: filepath.FromSlash("foo/work"), Nodes: map[string]Tree{
|
||||
"user": {Path: filepath.FromSlash("foo/work/user")},
|
||||
}},
|
||||
}},
|
||||
}},
|
||||
@ -395,9 +395,9 @@ func TestTree(t *testing.T) {
|
||||
{
|
||||
targets: []string{"./foo/work/user", "foo/work/user"},
|
||||
want: Tree{Nodes: map[string]Tree{
|
||||
"foo": Tree{Root: ".", FileInfoPath: "foo", Nodes: map[string]Tree{
|
||||
"work": Tree{FileInfoPath: filepath.FromSlash("foo/work"), Nodes: map[string]Tree{
|
||||
"user": Tree{Path: filepath.FromSlash("foo/work/user")},
|
||||
"foo": {Root: ".", FileInfoPath: "foo", Nodes: map[string]Tree{
|
||||
"work": {FileInfoPath: filepath.FromSlash("foo/work"), Nodes: map[string]Tree{
|
||||
"user": {Path: filepath.FromSlash("foo/work/user")},
|
||||
}},
|
||||
}},
|
||||
}},
|
||||
@ -406,10 +406,10 @@ func TestTree(t *testing.T) {
|
||||
win: true,
|
||||
targets: []string{`c:\users\foobar\temp`},
|
||||
want: Tree{Nodes: map[string]Tree{
|
||||
"c": Tree{Root: `c:\`, FileInfoPath: `c:\`, Nodes: map[string]Tree{
|
||||
"users": Tree{FileInfoPath: `c:\users`, Nodes: map[string]Tree{
|
||||
"foobar": Tree{FileInfoPath: `c:\users\foobar`, Nodes: map[string]Tree{
|
||||
"temp": Tree{Path: `c:\users\foobar\temp`},
|
||||
"c": {Root: `c:\`, FileInfoPath: `c:\`, Nodes: map[string]Tree{
|
||||
"users": {FileInfoPath: `c:\users`, Nodes: map[string]Tree{
|
||||
"foobar": {FileInfoPath: `c:\users\foobar`, Nodes: map[string]Tree{
|
||||
"temp": {Path: `c:\users\foobar\temp`},
|
||||
}},
|
||||
}},
|
||||
}},
|
||||
|
@ -179,26 +179,26 @@ func TestFileRestorerBasic(t *testing.T) {
|
||||
defer cleanup()
|
||||
|
||||
restoreAndVerify(t, tempdir, []TestFile{
|
||||
TestFile{
|
||||
{
|
||||
name: "file1",
|
||||
blobs: []TestBlob{
|
||||
TestBlob{"data1-1", "pack1-1"},
|
||||
TestBlob{"data1-2", "pack1-2"},
|
||||
{"data1-1", "pack1-1"},
|
||||
{"data1-2", "pack1-2"},
|
||||
},
|
||||
},
|
||||
TestFile{
|
||||
{
|
||||
name: "file2",
|
||||
blobs: []TestBlob{
|
||||
TestBlob{"data2-1", "pack2-1"},
|
||||
TestBlob{"data2-2", "pack2-2"},
|
||||
{"data2-1", "pack2-1"},
|
||||
{"data2-2", "pack2-2"},
|
||||
},
|
||||
},
|
||||
TestFile{
|
||||
{
|
||||
name: "file3",
|
||||
blobs: []TestBlob{
|
||||
// same blob multiple times
|
||||
TestBlob{"data3-1", "pack3-1"},
|
||||
TestBlob{"data3-1", "pack3-1"},
|
||||
{"data3-1", "pack3-1"},
|
||||
{"data3-1", "pack3-1"},
|
||||
},
|
||||
},
|
||||
})
|
||||
|
@ -244,7 +244,7 @@ func TestWalker(t *testing.T) {
|
||||
}),
|
||||
checkSkipFor(
|
||||
map[string]struct{}{
|
||||
"/subdir": struct{}{},
|
||||
"/subdir": {},
|
||||
}, []string{
|
||||
"/",
|
||||
"/foo",
|
||||
@ -299,7 +299,7 @@ func TestWalker(t *testing.T) {
|
||||
}),
|
||||
checkSkipFor(
|
||||
map[string]struct{}{
|
||||
"/subdir1": struct{}{},
|
||||
"/subdir1": {},
|
||||
}, []string{
|
||||
"/",
|
||||
"/foo",
|
||||
@ -312,8 +312,8 @@ func TestWalker(t *testing.T) {
|
||||
),
|
||||
checkSkipFor(
|
||||
map[string]struct{}{
|
||||
"/subdir1": struct{}{},
|
||||
"/subdir2/subsubdir2": struct{}{},
|
||||
"/subdir1": {},
|
||||
"/subdir2/subsubdir2": {},
|
||||
}, []string{
|
||||
"/",
|
||||
"/foo",
|
||||
@ -325,7 +325,7 @@ func TestWalker(t *testing.T) {
|
||||
),
|
||||
checkSkipFor(
|
||||
map[string]struct{}{
|
||||
"/foo": struct{}{},
|
||||
"/foo": {},
|
||||
}, []string{
|
||||
"/",
|
||||
"/foo",
|
||||
@ -390,7 +390,7 @@ func TestWalker(t *testing.T) {
|
||||
}),
|
||||
checkIgnore(
|
||||
map[string]struct{}{
|
||||
"/subdir1": struct{}{},
|
||||
"/subdir1": {},
|
||||
}, map[string]bool{
|
||||
"/subdir1": true,
|
||||
}, []string{
|
||||
@ -415,7 +415,7 @@ func TestWalker(t *testing.T) {
|
||||
),
|
||||
checkIgnore(
|
||||
map[string]struct{}{
|
||||
"/subdir2": struct{}{},
|
||||
"/subdir2": {},
|
||||
}, map[string]bool{
|
||||
"/subdir2": true,
|
||||
}, []string{
|
||||
|
Loading…
Reference in New Issue
Block a user