Code Room
Code reviewHardcr-g502
Subject Retry logicLevel Senior–Staff~18 minCommon in Networking & APIs interviewsIndustries Software development, Technology

Question

Review this Go helper that retries a transfer when the call returns any error, including timeouts.

What a strong answer looks like

Separate real bugs from style. Rank issues by severity, point at the root cause rather than the symptom, and suggest a concrete fix — specific and kind.

Talk through your review
Code to reviewgo
func transfer(ctx context.Context, req TransferReq) error {    var err error    for i := 0; i < 3; i++ {        err = bank.Transfer(ctx, req) // POST, no idempotency key        if err == nil {            return nil        }    }    return err}
Run or narrate your approach, then ask the coach.