I have a question about this runtime.KeepAlive call:
https://github.com/golang/go/blob/041ecb697f0e867a2bb0bf219cc2fd5f77057c2e/src/os/dir_unix.go#L68
(There are other examples in the stdlib as well, I think.)
It seems to me that, strictly speaking, KeepAlive is unnecessary here
since the compiler/runtime cannot know whether the loop will terminate
before the result of the ReadDirent is seen. Is that true?
I'm not arguing that the KeepAlive should be removed; it's probably
best to stick with the pattern syscall(f.Fd(), ...);
runtime.KeepAlive(f) in most cases. I'm just checking my understanding
here.
Thanks!
Caleb