On Windows (but not elsewhere) this fails with a "sharing violation":
path := "rename-after-open" fd, err := os.OpenFile(path, os.O_RDWR|os.O_CREATE, 0600) if err != nil { ... } err = os.Rename(path_a, path_b) // or os.Remove(path) if err != nil { ... } // sharing violation fd.Close() Does anyone know of Windows apps that expect this error, which is undocumented? Microsoft has suggested that Go on Windows should switch to Unix-like behavior: https://github.com/golang/go/issues/32088 -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/15fa6fee-c7c1-4191-a4c9-ff3991dec69c%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.