You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
os.File.Fd presumably returns a uintptr because it is designed to be platform-independent. On Windows it refers to a HANDLE, which is typedef'd pointer to void — which corresponds to a uintptr, not an int. On Unix platforms, you may assume that the uintptr returned by os.File.Fd can be safely converted to an int.
(I suppose that it is theoretically possible for uintptr to be smaller than int, but I don't believe that is the case for any platform currently supported by Go.)
Go version
go version go1.21.3 linux/amd64
Output of
go env
in your module/workspace:What did you do?
I am trying to use
unix.IoctlFileClone
.What did you see happen?
I noticed that I have to cast Go file descriptors (
file.Fd()
) toint
.What did you expect to see?
That I would not have to cast file descriptors (which are in Go
uintptr
) toint
.The text was updated successfully, but these errors were encountered: