File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed
Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -118,18 +118,18 @@ func Abort(err error) Error {
118118 return permanentError {err }
119119}
120120
121- var contextAttemptKey struct {}
121+ type ctxKey struct {}
122122
123123func withAttempt (ctx context.Context , attempt int ) context.Context {
124- return context .WithValue (ctx , contextAttemptKey , attempt )
124+ return context .WithValue (ctx , ctxKey {} , attempt )
125125}
126126
127127// Attempt returns the number of previous attempts. In other words, it returns
128128// the zero-based index of the request.
129129//
130130// Only call this function from within a retried function.
131131func Attempt (ctx context.Context ) int {
132- i := ctx .Value (contextAttemptKey )
132+ i := ctx .Value (ctxKey {} )
133133 if i == nil {
134134 return 0
135135 }
You can’t perform that action at this time.
0 commit comments