Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Using a named return here is normal, especially if we want to react to what the return is in a deferred function. Unfortunately, we use `err`. We set `err` in a goroutine, the goroutine that is issuing our request. If we return early due to a context cancelation, we return `ctx.Err()`, which also kills our request that is actively being issued, which sets `err`. Returning `ctx.Err()` also coincidentally sets err, meaning this code is bugged by doing a concurrent write to the same return value. Instead, we will use `err` only in the concurrent function, and will name our return `rerr`.
- Loading branch information