2 hours ago · Tech · hide · 0 comments

The first time I reached for testing/synctest, I assumed it was a sleep helper with better manners. The public API is small enough to support that assumption: synctest.Test(t, func(t *testing.T) { ... }) synctest.Wait() synctest.Sleep(d) // new in Go 1.27 Three functions, one obvious guess: fake time, wrapped in test scaffolding. That guess is wrong. It isn’t a sleep helper, a goroutine wrapper, or a mocking library. It’s a runtime feature wearing a testing package as a disguise.

No comments yet. Log in to reply on the Fediverse. Comments will appear here.