diff --git a/distribution/push_v1.go b/distribution/push_v1.go index b18958cdbd..36951f0d01 100644 --- a/distribution/push_v1.go +++ b/distribution/push_v1.go @@ -118,7 +118,7 @@ type v1DependencyImage struct { v1ImageCommon } -func newV1DependencyImage(l layer.Layer, parent *v1DependencyImage) (*v1DependencyImage, error) { +func newV1DependencyImage(l layer.Layer, parent *v1DependencyImage) *v1DependencyImage { v1ID := digest.Digest(l.ChainID()).Hex() config := "" @@ -133,7 +133,7 @@ func newV1DependencyImage(l layer.Layer, parent *v1DependencyImage) (*v1Dependen config: []byte(config), layer: l, }, - }, nil + } } // Retrieve the all the images to be uploaded in the correct order @@ -221,10 +221,7 @@ func (p *v1Pusher) imageListForTag(imgID image.ID, dependenciesSeen map[layer.Ch } } - dependencyImages, parent, err := generateDependencyImages(l.Parent(), dependenciesSeen) - if err != nil { - return nil, err - } + dependencyImages, parent := generateDependencyImages(l.Parent(), dependenciesSeen) topImage, err := newV1TopImage(imgID, img, l, parent) if err != nil { @@ -236,32 +233,29 @@ func (p *v1Pusher) imageListForTag(imgID image.ID, dependenciesSeen map[layer.Ch return } -func generateDependencyImages(l layer.Layer, dependenciesSeen map[layer.ChainID]*v1DependencyImage) (imageListForThisTag []v1Image, parent *v1DependencyImage, err error) { +func generateDependencyImages(l layer.Layer, dependenciesSeen map[layer.ChainID]*v1DependencyImage) (imageListForThisTag []v1Image, parent *v1DependencyImage) { if l == nil { - return nil, nil, nil + return nil, nil } - imageListForThisTag, parent, err = generateDependencyImages(l.Parent(), dependenciesSeen) + imageListForThisTag, parent = generateDependencyImages(l.Parent(), dependenciesSeen) if dependenciesSeen != nil { if dependencyImage, present := dependenciesSeen[l.ChainID()]; present { // This layer is already on the list, we can ignore it // and all its parents. - return imageListForThisTag, dependencyImage, nil + return imageListForThisTag, dependencyImage } } - dependencyImage, err := newV1DependencyImage(l, parent) - if err != nil { - return nil, nil, err - } + dependencyImage := newV1DependencyImage(l, parent) imageListForThisTag = append(imageListForThisTag, dependencyImage) if dependenciesSeen != nil { dependenciesSeen[l.ChainID()] = dependencyImage } - return imageListForThisTag, dependencyImage, nil + return imageListForThisTag, dependencyImage } // createImageIndex returns an index of an image's layer IDs and tags.