Why does os.RemoveAll ignore ErrNotExists?

155 views
Skip to first unread message

xiaq

unread,
Apr 24, 2023, 10:42:22 AM4/24/23
to golang-nuts
Hi,

The os.RemoveAll function does not return an error when the path doesn't exist. Given that this is documented explicitly and implemented using an explicit check, this seems to be a conscious design choice rather than an accidental implementation detail.

Does anybody know what the rationale behind this is? I haven't been able to find any information in this forum or elsewhere.

Tamás Gulácsi

unread,
Apr 24, 2023, 11:39:28 AM4/24/23
to golang-nuts
You want that path to be fully removed.
If it does not exist, then it's already done, nothing to do, the desired result has been achieved (already).
Reply all
Reply to author
Forward
0 new messages