FAQ
Hi.

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)


Thanks Manlio

--
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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Search Discussions

Discussion Posts

Follow ups

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 1 of 4 | next ›
Discussion Overview
groupgolang-nuts @
categoriesgo
postedMar 8, '16 at 11:44a
activeMar 8, '16 at 3:55p
posts4
users2
websitegolang.org

2 users in discussion

Matt Silverlock: 2 posts Manlio Perillo: 2 posts

People

Translate

site design / logo © 2021 Grokbase