spf13 / afero

A FileSystem Abstraction System for Go
Apache License 2.0
5.8k stars 498 forks source link

add option to have strict file creation behavior #374

Open natebrennand opened 1 year ago

natebrennand commented 1 year ago

Workaround for https://github.com/spf13/afero/issues/373

Adds an option to have MemMapFS fail when creating a file in a directory that DNE.

CLAassistant commented 1 year ago

CLA assistant check
All committers have signed the CLA.

Frassle commented 1 year ago

I'd consider it a bug that it ever allowed this in the first place. A file create on OsFs would fail, it would be less surprising if MemFs also had that behavior. We've had bugs slip by testing due to this difference, but I'm not sure we would have noticed that we need to turn strict mode on for MemFs if it was an option like this.

natebrennand commented 1 year ago

I agree that it's a bug, but fixing it would be a breaking change. Dunno that a v2 is anywhere on the horizon

Frassle commented 1 year ago

fixing it would be a breaking change.

Obligatory xkcd: https://xkcd.com/1172/