mirror of
https://github.com/restic/restic.git
synced 2025-08-12 11:47:43 +00:00
Merge pull request #2990 from MichaelEischer/fix-goreport-warnings
Fix some goreport warnings
This commit is contained in:
@@ -2094,7 +2094,7 @@ func TestMetadataChanged(t *testing.T) {
|
||||
want.Group = ""
|
||||
|
||||
// make another snapshot
|
||||
snapshotID, node3 := snapshot(t, repo, fs, snapshotID, "testfile")
|
||||
_, node3 := snapshot(t, repo, fs, snapshotID, "testfile")
|
||||
// Override username and group to empty string - in case underlying system has user with UID 51234
|
||||
// See https://github.com/restic/restic/issues/2372
|
||||
node3.User = ""
|
||||
|
@@ -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`},
|
||||
}},
|
||||
}},
|
||||
}},
|
||||
|
Reference in New Issue
Block a user