Skip to content

Commit

Permalink
Ensure specifying an empty platform is treated as default
Browse files Browse the repository at this point in the history
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 <derek@mcgstyle.net>
  • Loading branch information
dmcgowan committed Jul 31, 2018
1 parent 875b92c commit 3629344
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions client_opts.go
Expand Up @@ -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"
)
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit 3629344

Please sign in to comment.