I have a function Create(path string) that opens a file with the O_CREAT
and O_EXCL flags.
The fact that an error is returned if the file exists is probably part of
the API, so it should be documented. What is the best method?
1) Document that if there is an error, it will be of type *os.PathError.
2) Document that if path exists, the function returns os.ErrExists.
3) Document that if path exists, the function returns an error such that
os.IsExist(err) returns true.
4) Change the function result list from (*os.File, error) to (file
*os.File, ok bool, err error)
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 firstname.lastname@example.org.
For more options, visit https://groups.google.com/d/optout.