ini icon indicating copy to clipboard operation
ini copied to clipboard

Consider supporting filesystem lock mechanisms

Open radeksimko opened this issue 9 years ago • 1 comments

Obviously concurrent changes to the same ini file are now prevented via sync.RWMutex. This in-memory lock is totally sufficient for most use cases where user needs some safety checks in the same process, but I found myself in situation where I would find an actual file-lock handy.

e.g. to prevent user from opening the file in their editor and start editing the ini file while a go program (using this library) interacts with it.

I think there may be a way to implement this in a way that it doesn't break cross-platform compatibility - just have it gracefully degrade - on systems that don't support flock.

https://golang.org/pkg/syscall/#Flock

Any thoughts - any reasons why a potential PR would not be accepted?

radeksimko avatar Aug 01 '16 16:08 radeksimko

Seems not much resources can be found about Go flock...

  • https://github.com/nightlyone/lockfile
  • https://gist.github.com/jedy/4167513

Not sure how well they work cross-platform.

unknwon avatar Aug 03 '16 05:08 unknwon