Repository navigation
Actualize timers usage for go 1.23 - #74
Conversation
|
@glowfall, the test faillures seem to be pretty consistent, not flaky. I'm not sure why, since it naively appears to be a timing race... But, in any event, I am pretty sure it's a bug in the test code. I think it will go away if you swap lines 219 and 220 in |
Yep, looks like tests are broken now. And lines swapping does not seem to help. My guess is that now clocktest implementation (https://github.com/jonboulle/clockwork) behaves differently, relying on the old timers behavior. See open issue: jonboulle/clockwork#98 I can offer some poor man's fix of tests on the |
Yep, LGTM. |
| // information on why this is necessary. | ||
| func (f fakeClock) NewTimer(d time.Duration) internal.Timer { | ||
| return f.clockworkFakeClock.NewTimer(d) | ||
| t := f.clockworkFakeClock.NewTimer(d) |
There was a problem hiding this comment.
Name it timer to fix this lint issue.
BTW, you can run the linter locally before pushing via make lint.
There was a problem hiding this comment.
Got it, now it should be fixed
Head branch was pushed to by a user without write access
Go 1.23 comes with behavior changes in timers, check out the full article: https://go.dev/wiki/Go123Timer
In short, three important changes:
ResetanymoreStop()returnedfalseThe last part is very important, since existing calls to
<-timer.Chan()now could lead to deadlocks, see godoc:https://github.com/golang/go/blob/065c1359e1bc3d6744a925339484592b13d713dd/src/time/sleep.go#L105C1-L109C47