From 58fa344544b34571012d91f523cea54bf364549b Mon Sep 17 00:00:00 2001 From: Shiwei Zhang Date: Thu, 11 Nov 2021 13:18:10 +0800 Subject: [PATCH] unify auth (#338) Signed-off-by: Shiwei Zhang --- cmd/oras/resolver.go | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/cmd/oras/resolver.go b/cmd/oras/resolver.go index abba22115..bc1808692 100644 --- a/cmd/oras/resolver.go +++ b/cmd/oras/resolver.go @@ -1,7 +1,6 @@ package main import ( - "context" "crypto/tls" "fmt" "net/http" @@ -52,10 +51,7 @@ func newResolver(username, password string, insecure bool, plainHTTP bool, confi if err != nil { fmt.Fprintf(os.Stderr, "WARNING: Error loading auth file: %v\n", err) } - resolver, err := cli.Resolver(context.Background(), client, plainHTTP) - if err != nil { - fmt.Fprintf(os.Stderr, "WARNING: Error loading resolver: %v\n", err) - resolver = docker.NewResolver(*opts) - } - return resolver, opts + dockerCli := cli.(*auth.Client) + opts.Credentials = dockerCli.Credential + return docker.NewResolver(*opts), opts }