(ctx context.Context, attempt int)
| 26 | type loggerKey = struct{} |
| 27 | |
| 28 | func ContextWithAttempt(ctx context.Context, attempt int) context.Context { |
| 29 | return context.WithValue(ctx, attemptKey{}, attempt) |
| 30 | } |
| 31 | |
| 32 | func GetAttempt(ctx context.Context) int { |
| 33 | if attempt, ok := ctx.Value(attemptKey{}).(int); ok { |