Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Isn't using time.After for timeouts a bit of an anti-pattern? There is no way to cancel the pending computation.


This was fixed in Go 1.23 https://go.dev/doc/go1.23#timer-changes

They will get cleaned up.


I meant that the goroutine in the example keeps running. Often this contradicts the reason for having the timeout in the first place.


I'm not sure what you mean? The examples all return from their function.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: