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-changesThey 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.