diff --git a/atomicfile.go b/atomicfile.go index 32160d2..ae30037 100644 --- a/atomicfile.go +++ b/atomicfile.go @@ -107,8 +107,9 @@ func (f *File) Cancel() { // The check averts an A-B-A conflict during the window after renaming. if tmp := f.tmp; tmp != nil { f.tmp = nil + name := tmp.Name() tmp.Close() - os.Remove(tmp.Name()) + os.Remove(name) } }