From 3629344e6e1b1b5a259285fee384b6bc0d47b4f9 Mon Sep 17 00:00:00 2001 From: Derek McGowan Date: Tue, 31 Jul 2018 15:08:59 -0700 Subject: [PATCH] Ensure specifying an empty platform is treated as default The default platform had previously been provided using the empty string. This change ensures that the platforms field is always filled in correctly and empty string is properly interpreted. Signed-off-by: Derek McGowan --- client_opts.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/client_opts.go b/client_opts.go index 56ec400c6..6e6198739 100644 --- a/client_opts.go +++ b/client_opts.go @@ -18,6 +18,7 @@ package containerd import ( "github.com/containerd/containerd/images" + "github.com/containerd/containerd/platforms" "github.com/containerd/containerd/remotes" "google.golang.org/grpc" ) @@ -76,6 +77,9 @@ type RemoteOpt func(*Client, *RemoteContext) error // WithPlatform allows the caller to specify a platform to retrieve // content for func WithPlatform(platform string) RemoteOpt { + if platform == "" { + platform = platforms.Default() + } return func(_ *Client, c *RemoteContext) error { for _, p := range c.Platforms { if p == platform {