Skip to content

Commit ff7e357

Browse files
committed
Fix bug with variable being captured by goroutine.
1 parent 5f81b5d commit ff7e357

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

mocktime.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,9 @@ func setAdvance(t *time.Time, d *time.Duration) {
5252
if firedFn != nil {
5353
firedFn(e.Value.ch)
5454
}
55+
capturedV := e.Value
5556
go func() {
56-
e.Value.ch <- e.Value.expiry
57+
capturedV.ch <- capturedV.expiry
5758
}()
5859
afterChan.Remove(e)
5960
}

0 commit comments

Comments
 (0)