On Windows 10, in Go 1.13, it used to be possible to rename over a read only file (like it is in Unix). In Go 1.14 it is not. I'm not seeing anything specific about this in the release notes, was this an intentional change?
This probably seems to be side effect in 16f0f9c but I think this is not regression.
syscall: respect permission bits on file opening on Windows
On Windows, os.Chmod and syscall.Chmod toggle the FILE_ATTRIBUTES_
READONLY flag depending on the permission bits. That's a bit odd but I
guess some compromises were made at some point and this is what was
chosen to map to a Unix concept that Windows doesn't really have in the
same way. That's fine. However, the logic used in Chmod was forgotten
from os.Open and syscall.Open, which then manifested itself in various
places, most recently, go modules' read-only behavior.
This makes syscall.Open consistent with syscall.Chmod and adds a test
for the permission behavior using ioutil. By testing the behavior
instead of explicitly testing for the attribute bits we care about, we
make sure this doesn't regress in unforeseen ways in the future, as well
as ensuring the test works on platforms other than Windows.
In the process, we fix some tests that never worked and relied on broken
behavior, as well as tests that were disabled on Windows due to the
broken behavior and had TODO notes.
On Unix, rename to a read-only file is permitted. The directory must be writable.
So the question is whether os.Rename on Windows should make the effort to make this work the same way, by changing the file to not be read-only. I guess we often try to do that on Windows, so it makes sense to me, but I don't feel strongly about it.