Radar · Go · Archive · Week 33 · Aug 11 – 17, 2025
syscall: add Open O_* flags for Windows FILE_FLAG_* flags
Worth knowingecosystem
- What changed
- New constants such as
O_FILE_FLAG_OPEN_NO_RECALLwere added togolang.org/x/sys/windows, andsyscall.Openon Windows now accepts them and rejects unknown bits. - Production impact
- The source does not say.
- Try it
- On Windows, call
syscall.OpenwithO_FILE_FLAG_OPEN_NO_RECALLand observe that the flag is passed to the OS. - Source
- github.com/golang/go/issues/73676
Understand it, then run it
On Windows, the syscall.Open function can now accept a set of flags that match the native FILE_FLAG_* options. These flags let you control how a file is opened, for example whether the file is opened for overlapped (asynchronous) I/O or whether the file should be deleted when the last handle is closed. The change adds constants such as O_FILE_FLAG_OPEN_NO_RECALL to the golang.org/x/sys/windows package, and syscall.Open will pass those flags straight to the operating system. If you try to pass a flag that the runtime does not understand, syscall.Open will return an error instead of silently ignoring the bit.
Written by gpt-oss-20b from the linked source · claims checked against the sources · archive, not individually reviewed