What did you do?

client = &acme.Client{
            Key:          config.PrivateKey,
            DirectoryURL: *ServerApiURL,
            RetryBackoff: func(n int, r *http.Request, res *http.Response) time.Duration {
                ctx := r.Context()
                retryLogger := zc.L(ctx) // get logger from context https://github.com/rekby/zapcontext
                if retryLogger == nil {
                    retryLogger = logger.With(zap.String("request_context", "no-logger"))
                }
                                retryLogger.Info("Test")
                       }
}

Send request to Lets encrypt with retrieval error. _, err = client.Accept(ctx, httpchallenge)

What did you expect to see?

logs with my logger from ctx, and without request_context" = "no-logger"

What did you see instead?

logs with "request_context" = "no-logger" and without my logger from context ctx.

I suggest to send req with external context to function. Now it receive clear context (but http call do with external context). My patch for self: https://github.com/rekby/crypto/commit/9874cac870c3253304772cee7f13a87c56040e88

Comment From: bcmills

CC @FiloSottile @agl for x/crypto

Comment From: gopherbot

Change https://go.dev/cl/719002 mentions this issue: acme: pass context to request