From 4ebaacfcdae9ebcdb02571f88047d4d0efaf89b1 Mon Sep 17 00:00:00 2001 From: Aaron Lehmann Date: Fri, 11 Dec 2015 15:13:03 -0800 Subject: [PATCH] Remove unnecessary stat from blob Get method This calls Stat before Open, which should be unnecessary because Open can handle the case of a nonexistent blob. Removing the Stat saves a round trip. This is similar to the removal of stat in Open in #1226. Signed-off-by: Aaron Lehmann --- docs/client/repository.go | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/docs/client/repository.go b/docs/client/repository.go index bb10ece7..8f525f0d 100644 --- a/docs/client/repository.go +++ b/docs/client/repository.go @@ -377,11 +377,7 @@ func (bs *blobs) Stat(ctx context.Context, dgst digest.Digest) (distribution.Des } func (bs *blobs) Get(ctx context.Context, dgst digest.Digest) ([]byte, error) { - desc, err := bs.Stat(ctx, dgst) - if err != nil { - return nil, err - } - reader, err := bs.Open(ctx, desc.Digest) + reader, err := bs.Open(ctx, dgst) if err != nil { return nil, err }