diff options
author | Sebastiaan van Stijn <github@gone.nl> | 2022-02-18 16:30:25 +0100 |
---|---|---|
committer | Sebastiaan van Stijn <github@gone.nl> | 2022-02-18 16:58:35 +0100 |
commit | 3309ea94190a9e3fba4da2492cf569dd5765e45a (patch) | |
tree | a6abeeede9f276c8198b0789d5e7382e5f973b42 /distribution | |
parent | 4c7dc9806cb88d829b63ea90689e7e630fc59ba2 (diff) |
distribution/xfer: slightly more idomatic type assertion
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Diffstat (limited to 'distribution')
-rw-r--r-- | distribution/xfer/download.go | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/distribution/xfer/download.go b/distribution/xfer/download.go index ff417ea99d..1b49fc775b 100644 --- a/distribution/xfer/download.go +++ b/distribution/xfer/download.go @@ -137,8 +137,7 @@ func (ldm *LayerDownloadManager) Download(ctx context.Context, initialRootFS ima missingLayer = false rootFS.Append(diffID) // Register this repository as a source of this layer. - withRegistered, hasRegistered := descriptor.(DownloadDescriptorWithRegistered) - if hasRegistered { // As layerstore may set the driver + if withRegistered, ok := descriptor.(DownloadDescriptorWithRegistered); ok { // As layerstore may set the driver withRegistered.Registered(diffID) } continue @@ -360,8 +359,8 @@ func (ldm *LayerDownloadManager) makeDownloadFunc(descriptor DownloadDescriptor, } progress.Update(progressOutput, descriptor.ID(), "Pull complete") - withRegistered, hasRegistered := descriptor.(DownloadDescriptorWithRegistered) - if hasRegistered { + + if withRegistered, ok := descriptor.(DownloadDescriptorWithRegistered); ok { withRegistered.Registered(d.layer.DiffID()) } @@ -453,8 +452,7 @@ func (ldm *LayerDownloadManager) makeDownloadFuncFromDownload(descriptor Downloa return } - withRegistered, hasRegistered := descriptor.(DownloadDescriptorWithRegistered) - if hasRegistered { + if withRegistered, ok := descriptor.(DownloadDescriptorWithRegistered); ok { withRegistered.Registered(d.layer.DiffID()) } |