I am trying to open a file and I would like to know if it does not exist in order to respond. But a mistake
os.OpenFile(fName, os.O_WRONLY, 0600)
returns when the file does not exist, different from os.ErrNotExists
os.ErrNotExists -> "file does not exist" err.(*os.PathError).Err -> "no such file or directory"
os.Stat also returns the same error if the file is not there. Is there a predefined error that I can compare with, instead of doing it manually?
go error-handling
AdriΓ casajΓΊs
source share