Hacker News
new
|
past
|
comments
|
ask
|
show
|
jobs
|
submit
login
fweimer
53 days ago
|
parent
|
context
|
favorite
| on:
Go subtleties
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
53 days ago
[–]
This was fixed in Go 1.23
https://go.dev/doc/go1.23#timer-changes
They will get cleaned up.
fweimer
53 days ago
|
parent
[–]
I 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
52 days ago
|
root
|
parent
[–]
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: