From 2f8335554c8e84c5b6eb19f8b2c62b927f4b17ef Mon Sep 17 00:00:00 2001 From: Michael Eischer Date: Fri, 6 Mar 2020 23:32:12 +0100 Subject: [PATCH] Remove a few unused variables --- cmd/restic/integration_helpers_test.go | 2 +- cmd/restic/integration_test.go | 4 ++-- internal/repository/master_index_test.go | 6 +++--- internal/repository/worker_group.go | 2 +- internal/ui/termstatus/status.go | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/cmd/restic/integration_helpers_test.go b/cmd/restic/integration_helpers_test.go index 0069e27a9..1bbd41cb8 100644 --- a/cmd/restic/integration_helpers_test.go +++ b/cmd/restic/integration_helpers_test.go @@ -55,7 +55,7 @@ func walkDir(dir string) <-chan *dirEntry { }() // first element is root - _ = <-ch + <-ch return ch } diff --git a/cmd/restic/integration_test.go b/cmd/restic/integration_test.go index 74661ca1c..20e5e6402 100644 --- a/cmd/restic/integration_test.go +++ b/cmd/restic/integration_test.go @@ -1105,14 +1105,14 @@ func TestRestoreNoMetadataOnIgnoredIntermediateDirs(t *testing.T) { testRunRestoreIncludes(t, env.gopts, filepath.Join(env.base, "restore0"), snapshotID, []string{"*.ext"}) f1 := filepath.Join(env.base, "restore0", "testdata", "subdir1", "subdir2") - fi, err := os.Stat(f1) + _, err := os.Stat(f1) rtest.OK(t, err) // restore with filter "*", this should restore meta data on everything. testRunRestoreIncludes(t, env.gopts, filepath.Join(env.base, "restore1"), snapshotID, []string{"*"}) f2 := filepath.Join(env.base, "restore1", "testdata", "subdir1", "subdir2") - fi, err = os.Stat(f2) + fi, err := os.Stat(f2) rtest.OK(t, err) rtest.Assert(t, fi.ModTime() == time.Unix(0, 0), diff --git a/internal/repository/master_index_test.go b/internal/repository/master_index_test.go index 5831fba63..28eba03a8 100644 --- a/internal/repository/master_index_test.go +++ b/internal/repository/master_index_test.go @@ -120,7 +120,7 @@ func TestMasterIndex(t *testing.T) { rtest.Assert(t, !found, "Expected no blobs when fetching with a random id") blobs = mIdx.Lookup(restic.NewRandomID(), restic.DataBlob) rtest.Assert(t, blobs == nil, "Expected no blobs when fetching with a random id") - size, found = mIdx.LookupSize(restic.NewRandomID(), restic.DataBlob) + _, found = mIdx.LookupSize(restic.NewRandomID(), restic.DataBlob) rtest.Assert(t, !found, "Expected no blobs when fetching with a random id") // Test Count @@ -172,7 +172,7 @@ func TestMasterMergeFinalIndexes(t *testing.T) { rtest.Equals(t, 1, len(allIndexes)) blobCount := 0 - for _ = range mIdx.Each(context.TODO()) { + for range mIdx.Each(context.TODO()) { blobCount++ } rtest.Equals(t, 2, blobCount) @@ -207,7 +207,7 @@ func TestMasterMergeFinalIndexes(t *testing.T) { rtest.Equals(t, []restic.PackedBlob{blob2}, blobs) blobCount = 0 - for _ = range mIdx.Each(context.TODO()) { + for range mIdx.Each(context.TODO()) { blobCount++ } rtest.Equals(t, 2, blobCount) diff --git a/internal/repository/worker_group.go b/internal/repository/worker_group.go index 20783b188..52988f0bd 100644 --- a/internal/repository/worker_group.go +++ b/internal/repository/worker_group.go @@ -11,7 +11,7 @@ import ( // one of the workers, it is returned. FinalFunc is always run, regardless of // any other previous errors. func RunWorkers(ctx context.Context, count int, workerFunc func() error, finalFunc func()) error { - wg, ctx := errgroup.WithContext(ctx) + wg, _ := errgroup.WithContext(ctx) // run workers for i := 0; i < count; i++ { diff --git a/internal/ui/termstatus/status.go b/internal/ui/termstatus/status.go index e8bfa95cd..c1648206b 100644 --- a/internal/ui/termstatus/status.go +++ b/internal/ui/termstatus/status.go @@ -204,7 +204,7 @@ func (t *Terminal) runWithoutStatus(ctx context.Context) { fmt.Fprintf(os.Stderr, "flush failed: %v\n", err) } - case _ = <-t.status: + case <-t.status: // discard status lines } }