Skip to content

Commit

Permalink
deadlineCtx.Err: Use defer
Browse files Browse the repository at this point in the history
Co-authored-by: Jacob Oaks <jacoboaks.8@gmail.com>
  • Loading branch information
abhinav and JacobOaks authored Feb 13, 2024
1 parent 491b698 commit d812953
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions internal/fxclock/clock.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,9 +161,8 @@ func (c *deadlineCtx) Value(key any) any { return c.inner.

func (c *deadlineCtx) Err() error {
c.mu.Lock()
err := c.err
c.mu.Unlock()
return err
defer c.mu.Unlock()
return c.err
}

func (c *deadlineCtx) cancel(err error) {
Expand Down

0 comments on commit d812953

Please sign in to comment.