remotes: remove unnecessary string formatting

Signed-off-by: Jintao Zhang <zhangjintao9020@gmail.com>
This commit is contained in:
Jintao Zhang 2019-08-05 02:16:57 +08:00
parent f0821348b4
commit 4b4ce4a26c

View File

@ -265,7 +265,7 @@ func (ah *authHandler) doBasicAuth(ctx context.Context) (string, error) {
} }
auth := base64.StdEncoding.EncodeToString([]byte(username + ":" + secret)) auth := base64.StdEncoding.EncodeToString([]byte(username + ":" + secret))
return fmt.Sprintf("%s %s", "Basic", auth), nil return fmt.Sprintf("Basic %s", auth), nil
} }
func (ah *authHandler) doBearerAuth(ctx context.Context) (string, error) { func (ah *authHandler) doBearerAuth(ctx context.Context) (string, error) {
@ -307,7 +307,7 @@ func (ah *authHandler) doBearerAuth(ctx context.Context) (string, error) {
token, err = ah.fetchToken(ctx, to) token, err = ah.fetchToken(ctx, to)
err = errors.Wrap(err, "failed to fetch anonymous token") err = errors.Wrap(err, "failed to fetch anonymous token")
} }
token = fmt.Sprintf("%s %s", "Bearer", token) token = fmt.Sprintf("Bearer %s", token)
r.token, r.err = token, err r.token, r.err = token, err
r.Done() r.Done()