extend safe package by finalizers
kamilsk opened this issue · comments
Kamil Samigullin commented
https://golang.org/pkg/runtime/#SetFinalizer
file, err := safe.OpenFile()
if err ...
// no call defer file.Close()
// panic in runtime
how it works
Open() -> SetFinalizer
Close() -> UnsetFinalizer
Kamil Samigullin commented
also, the custom profiler can be usefull:
Open() -> profile.Add
Close() -> profile.Remove