Platforms: Add From/ToProto helpers for types
Helpers to convert from a slice of platforms to our protobuf representation and vice-versa appear a couple times. It seems sane to just expose this facility in the platforms pkg. Signed-off-by: Danny Canter <danny@dcantah.dev>
This commit is contained in:
@@ -156,15 +156,7 @@ func (iis *ImageExportStream) UnmarshalAny(ctx context.Context, sm streaming.Str
|
||||
return err
|
||||
}
|
||||
|
||||
var specified []v1.Platform
|
||||
for _, p := range s.Platforms {
|
||||
specified = append(specified, v1.Platform{
|
||||
OS: p.OS,
|
||||
Architecture: p.Architecture,
|
||||
Variant: p.Variant,
|
||||
})
|
||||
}
|
||||
|
||||
specified := platforms.FromProto(s.Platforms)
|
||||
iis.stream = tstreaming.WriteByteStream(ctx, stream)
|
||||
iis.mediaType = s.MediaType
|
||||
iis.platforms = specified
|
||||
|
||||
Reference in New Issue
Block a user