singlefile
singlefile copied to clipboard
proposal: cross-platform solution
I found that this pkg has no solution for Windows, but it's not my problem, I just asked myself, why did you use this approach?
I'm not sure in my way, but let me propose it.
- Define
map[string]bool
suring pkg'sinit()
- Lock adds new element to a map
- unlock will remove it
Or we can do it without map. Or even with mutex.
If user's code between Lock and Unlock will have a pnic we will lost a lock. And it is good I think.
@plutov your approach does not support host-wide locks, which is the problem this package successfully solves.
also, FYI, smallest type in Go is struct{}
, not bool
.