From 8d4417ec924b55fac913ad25d3505634e8592b1c Mon Sep 17 00:00:00 2001 From: Alexander Neumann Date: Sun, 11 Jun 2017 09:29:53 +0200 Subject: [PATCH] Remove unused code/variables --- src/cmds/restic/flags_test.go | 4 ---- .../restic/integration_helpers_unix_test.go | 5 ----- src/restic/backend/rest/rest.go | 2 -- src/restic/backend/s3/s3.go | 2 -- src/restic/buffer_pool.go | 21 ------------------- src/restic/fuse/file.go | 2 -- src/restic/repository/parallel.go | 10 --------- 7 files changed, 46 deletions(-) delete mode 100644 src/restic/buffer_pool.go diff --git a/src/cmds/restic/flags_test.go b/src/cmds/restic/flags_test.go index 7cd758592..b7f88e906 100644 --- a/src/cmds/restic/flags_test.go +++ b/src/cmds/restic/flags_test.go @@ -8,10 +8,6 @@ import ( // TestFlags checks for double defined flags, the commands will panic on // ParseFlags() when a shorthand flag is defined twice. func TestFlags(t *testing.T) { - type FlagParser interface { - ParseFlags([]string) error - } - for _, cmd := range cmdRoot.Commands() { t.Run(cmd.Name(), func(t *testing.T) { cmd.Flags().SetOutput(ioutil.Discard) diff --git a/src/cmds/restic/integration_helpers_unix_test.go b/src/cmds/restic/integration_helpers_unix_test.go index 01a0fd5a5..2a06db63d 100644 --- a/src/cmds/restic/integration_helpers_unix_test.go +++ b/src/cmds/restic/integration_helpers_unix_test.go @@ -52,11 +52,6 @@ func nlink(info os.FileInfo) uint64 { return uint64(stat.Nlink) } -func inode(info os.FileInfo) uint64 { - stat, _ := info.Sys().(*syscall.Stat_t) - return uint64(stat.Ino) -} - func createFileSetPerHardlink(dir string) map[uint64][]string { var stat syscall.Stat_t linkTests := make(map[uint64][]string) diff --git a/src/restic/backend/rest/rest.go b/src/restic/backend/rest/rest.go index f702a7a03..4145a2a32 100644 --- a/src/restic/backend/rest/rest.go +++ b/src/restic/backend/rest/rest.go @@ -20,8 +20,6 @@ import ( "restic/backend" ) -const connLimit = 40 - // make sure the rest backend implements restic.Backend var _ restic.Backend = &restBackend{} diff --git a/src/restic/backend/s3/s3.go b/src/restic/backend/s3/s3.go index 0d223a63a..8b41bfe6b 100644 --- a/src/restic/backend/s3/s3.go +++ b/src/restic/backend/s3/s3.go @@ -18,8 +18,6 @@ import ( "restic/debug" ) -const connLimit = 10 - // Backend stores data on an S3 endpoint. type Backend struct { client *minio.Client diff --git a/src/restic/buffer_pool.go b/src/restic/buffer_pool.go deleted file mode 100644 index 25603bbfe..000000000 --- a/src/restic/buffer_pool.go +++ /dev/null @@ -1,21 +0,0 @@ -package restic - -import ( - "sync" - - "github.com/restic/chunker" -) - -var bufPool = sync.Pool{ - New: func() interface{} { - return make([]byte, chunker.MinSize) - }, -} - -func getBuf() []byte { - return bufPool.Get().([]byte) -} - -func freeBuf(data []byte) { - bufPool.Put(data) -} diff --git a/src/restic/fuse/file.go b/src/restic/fuse/file.go index cfb799a82..81ecfb76e 100644 --- a/src/restic/fuse/file.go +++ b/src/restic/fuse/file.go @@ -39,8 +39,6 @@ type file struct { blobs [][]byte } -const defaultBlobSize = 128 * 1024 - func newFile(repo BlobLoader, node *restic.Node, ownerIsRoot bool, blobsize *BlobSizeCache) (fusefile *file, err error) { debug.Log("create new file for %v with %d blobs", node.Name, len(node.Content)) var bytes uint64 diff --git a/src/restic/repository/parallel.go b/src/restic/repository/parallel.go index 7797dacae..fa0c2032f 100644 --- a/src/restic/repository/parallel.go +++ b/src/restic/repository/parallel.go @@ -8,16 +8,6 @@ import ( "restic/debug" ) -func closeIfOpen(ch chan struct{}) { - // only close ch when it is not already closed, in which the case statement runs. - select { - case <-ch: - return - default: - close(ch) - } -} - // ParallelWorkFunc gets one file ID to work on. If an error is returned, // processing stops. When the contect is cancelled the function should return. type ParallelWorkFunc func(ctx context.Context, id string) error