mirror of
https://github.com/octoleo/restic.git
synced 2024-11-25 22:27:35 +00:00
Fix gofmt -s warnings
This commit is contained in:
parent
971ecee171
commit
2b9323529f
@ -92,7 +92,7 @@ func pruneRepository(gopts GlobalOptions, repo restic.Repository) error {
|
||||
}
|
||||
|
||||
Verbosef("counting files in repo\n")
|
||||
for _ = range repo.List(restic.DataFile, ctx.Done()) {
|
||||
for range repo.List(restic.DataFile, ctx.Done()) {
|
||||
stats.packs++
|
||||
}
|
||||
|
||||
|
@ -45,7 +45,7 @@ func rebuildIndex(ctx context.Context, repo restic.Repository) error {
|
||||
Verbosef("counting files in repo\n")
|
||||
|
||||
var packs uint64
|
||||
for _ = range repo.List(restic.DataFile, ctx.Done()) {
|
||||
for range repo.List(restic.DataFile, ctx.Done()) {
|
||||
packs++
|
||||
}
|
||||
|
||||
|
@ -72,7 +72,7 @@ func (r *Reader) Archive(name string, rd io.Reader, p *restic.Progress) (*restic
|
||||
|
||||
tree := &restic.Tree{
|
||||
Nodes: []*restic.Node{
|
||||
&restic.Node{
|
||||
{
|
||||
Name: name,
|
||||
AccessTime: time.Now(),
|
||||
ModTime: time.Now(),
|
||||
|
@ -129,7 +129,7 @@ func BenchmarkArchiveDirectory(b *testing.B) {
|
||||
}
|
||||
|
||||
func countPacks(repo restic.Repository, t restic.FileType) (n uint) {
|
||||
for _ = range repo.Backend().List(t, nil) {
|
||||
for range repo.Backend().List(t, nil) {
|
||||
n++
|
||||
}
|
||||
|
||||
|
@ -143,7 +143,7 @@ func (f *file) Read(ctx context.Context, req *fuse.ReadRequest, resp *fuse.ReadR
|
||||
}
|
||||
|
||||
if offset > 0 {
|
||||
blob = blob[offset:len(blob)]
|
||||
blob = blob[offset:]
|
||||
offset = 0
|
||||
}
|
||||
|
||||
|
@ -71,7 +71,7 @@ func parseTime(s string) time.Time {
|
||||
}
|
||||
|
||||
var nodeTests = []restic.Node{
|
||||
restic.Node{
|
||||
{
|
||||
Name: "testFile",
|
||||
Type: "file",
|
||||
Content: restic.IDs{},
|
||||
@ -82,7 +82,7 @@ var nodeTests = []restic.Node{
|
||||
AccessTime: parseTime("2015-05-14 21:07:24.222"),
|
||||
ChangeTime: parseTime("2015-05-14 21:07:25.333"),
|
||||
},
|
||||
restic.Node{
|
||||
{
|
||||
Name: "testSuidFile",
|
||||
Type: "file",
|
||||
Content: restic.IDs{},
|
||||
@ -93,7 +93,7 @@ var nodeTests = []restic.Node{
|
||||
AccessTime: parseTime("2015-05-14 21:07:24.222"),
|
||||
ChangeTime: parseTime("2015-05-14 21:07:25.333"),
|
||||
},
|
||||
restic.Node{
|
||||
{
|
||||
Name: "testSuidFile2",
|
||||
Type: "file",
|
||||
Content: restic.IDs{},
|
||||
@ -104,7 +104,7 @@ var nodeTests = []restic.Node{
|
||||
AccessTime: parseTime("2015-05-14 21:07:24.222"),
|
||||
ChangeTime: parseTime("2015-05-14 21:07:25.333"),
|
||||
},
|
||||
restic.Node{
|
||||
{
|
||||
Name: "testSticky",
|
||||
Type: "file",
|
||||
Content: restic.IDs{},
|
||||
@ -115,7 +115,7 @@ var nodeTests = []restic.Node{
|
||||
AccessTime: parseTime("2015-05-14 21:07:24.222"),
|
||||
ChangeTime: parseTime("2015-05-14 21:07:25.333"),
|
||||
},
|
||||
restic.Node{
|
||||
{
|
||||
Name: "testDir",
|
||||
Type: "dir",
|
||||
Subtree: nil,
|
||||
@ -126,7 +126,7 @@ var nodeTests = []restic.Node{
|
||||
AccessTime: parseTime("2015-05-14 21:07:24.222"),
|
||||
ChangeTime: parseTime("2015-05-14 21:07:25.333"),
|
||||
},
|
||||
restic.Node{
|
||||
{
|
||||
Name: "testSymlink",
|
||||
Type: "symlink",
|
||||
LinkTarget: "invalid",
|
||||
@ -140,7 +140,7 @@ var nodeTests = []restic.Node{
|
||||
|
||||
// include "testFile" and "testDir" again with slightly different
|
||||
// metadata, so we can test if CreateAt works with pre-existing files.
|
||||
restic.Node{
|
||||
{
|
||||
Name: "testFile",
|
||||
Type: "file",
|
||||
Content: restic.IDs{},
|
||||
@ -151,7 +151,7 @@ var nodeTests = []restic.Node{
|
||||
AccessTime: parseTime("2005-05-14 21:07:04.222"),
|
||||
ChangeTime: parseTime("2005-05-14 21:07:05.333"),
|
||||
},
|
||||
restic.Node{
|
||||
{
|
||||
Name: "testDir",
|
||||
Type: "dir",
|
||||
Subtree: nil,
|
||||
|
@ -233,7 +233,7 @@ func TestListOptions(t *testing.T) {
|
||||
Foo string `option:"foo" help:"bar text help"`
|
||||
}{},
|
||||
[]Help{
|
||||
Help{Name: "foo", Text: "bar text help"},
|
||||
{Name: "foo", Text: "bar text help"},
|
||||
},
|
||||
},
|
||||
{
|
||||
@ -242,8 +242,8 @@ func TestListOptions(t *testing.T) {
|
||||
Bar string `option:"bar" help:"bar text help"`
|
||||
}{},
|
||||
[]Help{
|
||||
Help{Name: "foo", Text: "bar text help"},
|
||||
Help{Name: "bar", Text: "bar text help"},
|
||||
{Name: "foo", Text: "bar text help"},
|
||||
{Name: "bar", Text: "bar text help"},
|
||||
},
|
||||
},
|
||||
{
|
||||
@ -252,14 +252,14 @@ func TestListOptions(t *testing.T) {
|
||||
Foo string `option:"foo" help:"bar text help"`
|
||||
}{},
|
||||
[]Help{
|
||||
Help{Name: "bar", Text: "bar text help"},
|
||||
Help{Name: "foo", Text: "bar text help"},
|
||||
{Name: "bar", Text: "bar text help"},
|
||||
{Name: "foo", Text: "bar text help"},
|
||||
},
|
||||
},
|
||||
{
|
||||
&teststruct,
|
||||
[]Help{
|
||||
Help{Name: "foo", Text: "bar text help"},
|
||||
{Name: "foo", Text: "bar text help"},
|
||||
},
|
||||
},
|
||||
}
|
||||
@ -290,9 +290,9 @@ func TestAppendAllOptions(t *testing.T) {
|
||||
}{},
|
||||
},
|
||||
[]Help{
|
||||
Help{Namespace: "local", Name: "foo", Text: "bar text help"},
|
||||
Help{Namespace: "sftp", Name: "bar", Text: "bar text help"},
|
||||
Help{Namespace: "sftp", Name: "foo", Text: "bar text help2"},
|
||||
{Namespace: "local", Name: "foo", Text: "bar text help"},
|
||||
{Namespace: "sftp", Name: "bar", Text: "bar text help"},
|
||||
{Namespace: "sftp", Name: "foo", Text: "bar text help2"},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
@ -71,7 +71,7 @@ func Repack(repo restic.Repository, packs restic.IDSet, keepBlobs restic.BlobSet
|
||||
|
||||
debug.Log(" process blob %v", h)
|
||||
|
||||
buf = buf[:len(buf)]
|
||||
buf = buf[:]
|
||||
if uint(len(buf)) < entry.Length {
|
||||
buf = make([]byte, entry.Length)
|
||||
}
|
||||
|
@ -56,11 +56,11 @@ func TestTree(t *testing.T) {
|
||||
}
|
||||
|
||||
var testNodes = []restic.Node{
|
||||
restic.Node{Name: "normal"},
|
||||
restic.Node{Name: "with backslashes \\zzz"},
|
||||
restic.Node{Name: "test utf-8 föbärß"},
|
||||
restic.Node{Name: "test invalid \x00\x01\x02\x03\x04"},
|
||||
restic.Node{Name: "test latin1 \x75\x6d\x6c\xe4\xfc\x74\xf6\x6e\xdf\x6e\x6c\x6c"},
|
||||
{Name: "normal"},
|
||||
{Name: "with backslashes \\zzz"},
|
||||
{Name: "test utf-8 föbärß"},
|
||||
{Name: "test invalid \x00\x01\x02\x03\x04"},
|
||||
{Name: "test latin1 \x75\x6d\x6c\xe4\xfc\x74\xf6\x6e\xdf\x6e\x6c\x6c"},
|
||||
}
|
||||
|
||||
func TestNodeMarshal(t *testing.T) {
|
||||
|
@ -1389,7 +1389,7 @@ func BenchmarkDelayedWalkTree(t *testing.B) {
|
||||
treeJobs := make(chan walk.TreeJob)
|
||||
go walk.Tree(dr, root, nil, treeJobs)
|
||||
|
||||
for _ = range treeJobs {
|
||||
for range treeJobs {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user