3 ms·
Isn't using time.After for timeouts a bit of an anti-pattern? There is no way to cancel the pending computation.
by fweimer 1y ago
Isn't using time.After for timeouts a bit of an anti-pattern? There is no way to cancel the pending computation.
- Philip-J-Fry 1y agoThis was fixed in Go 1.23 https://go.dev/doc/go1.23#timer-changes https://go.dev/doc/go1.23#timer-changes They will get cleaned up.
- fweimer 1y agoI meant that the goroutine in the example keeps running. Often this contradicts the reason for having the timeout in the first place.
- Philip-J-Fry 1y agoI'm not sure what you mean? The examples all return from their function.