Handle additional cleanups from prior PR

Update comment and streamline getting the default platform spec

Signed-off-by: Phil Estes <estesp@linux.vnet.ibm.com>
This commit is contained in:
Phil Estes 2019-01-16 13:07:29 -05:00
parent df97414a77
commit b444d7d507
No known key found for this signature in database
GPG Key ID: 0F386284C03A1162

View File

@ -41,7 +41,7 @@ type V1Exporter struct {
AllPlatforms bool AllPlatforms bool
} }
// V1ExporterOpt allows to set additional options to a newly V1Exporter // V1ExporterOpt allows the caller to set additional options to a new V1Exporter
type V1ExporterOpt func(c *V1Exporter) error type V1ExporterOpt func(c *V1Exporter) error
// DefaultV1Exporter return a default V1Exporter pointer // DefaultV1Exporter return a default V1Exporter pointer
@ -91,11 +91,7 @@ func (oe *V1Exporter) Export(ctx context.Context, store content.Provider, desc o
if !oe.AllPlatforms { if !oe.AllPlatforms {
// get local default platform to fetch image manifest // get local default platform to fetch image manifest
p, err := platforms.Parse(platforms.DefaultString()) childrenHandler = images.FilterPlatforms(childrenHandler, platforms.Any(platforms.DefaultSpec()))
if err != nil {
return errors.Wrapf(err, "invalid platform %s", platforms.DefaultString())
}
childrenHandler = images.FilterPlatforms(childrenHandler, platforms.Any(p))
} }
handlers := images.Handlers( handlers := images.Handlers(