File WriteAt auto commit

Hi there,

Recently, I am learning writing data into files. I noticed there is a function called Sync(), which is used to commit the changes made on the file from memory to the disk. I understand that Close() will automatically commit the changes to the disk. However, when I am running some tests, I noticed that without using Sync() and Close(), the data will commit to the disk as well by using WriteAt().

Does that mean the WriteAt() will automatically commit changes to the disk?

Any help is appreciated.

Best,
Shawn

If u use Goland, u can focus cursor on this func and enter Command+B , now u can see that is happens in this func

Do you use File.WriteAt?

If you take a look at the source code, you will see that there is nothing that automatically commits changes to disk.

Are you sure about this behaviour? Is it reproducible?

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.