github.com/TrueBlocks/trueblocks-core/src/apps/chifra@v0.0.0-20241022031540-b362680128f7/pkg/file/remove.go (about) 1 // Copyright 2021 The TrueBlocks Authors. All rights reserved. 2 // Use of this source code is governed by a license that can 3 // be found in the LICENSE file. 4 5 package file 6 7 import ( 8 "os" 9 "sync" 10 ) 11 12 var removeMutex = sync.Mutex{} 13 14 func Remove(fileName string) bool { 15 if !FileExists(fileName) { 16 return true 17 } 18 19 removeMutex.Lock() 20 os.Remove(fileName) 21 removeMutex.Unlock() 22 return !FileExists(fileName) 23 }