This has been discussed before a few times. I think the conclusion is
that it's not actually needed very often and that using os.Stat is
easy enough for the cases where it is required.
Note that newcomers often feel that they need an os.Exists function
before learning of a better way to do what they're trying to do. For
instance: if you are going to open the file, there's no reason to
check whether it exists first. The file could disappear in between
checking and opening, and anyway you'll need to check the os.Open
error regardless. So you simply call os.IsNotExist(err) after you try
to open the file, and deal with its non-existence there (if that
requires special handling).
On Mon, Mar 17, 2014 at 4:09 PM, Andrei Simionescu
> I think a method path.Exists(path string) bool would be a nice thing to have
> – newbies like me will probably find this snippet of code  and implement
> the same helper method, anyway.
> Pros: Makes the language more newbie-friendly, thus potentially increasing
> Cons: ??
> I can imagine language adoption being low on the priority list, but I don't
> see how adding this would hurt. Opinions?
> Thanks (and sorry if this has been discussed before)
> 0: http://stackoverflow.com/a/12518877/479736 >
> 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...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.