Initial commit
This commit is contained in:
Executable
+27
@@ -0,0 +1,27 @@
|
||||
package file
|
||||
|
||||
import (
|
||||
"go_project/pkg/behaivor"
|
||||
"os"
|
||||
)
|
||||
|
||||
// Verification of the existence of a program with an emergency termination in case of an error
|
||||
func MustIsNotExist(filename string) (result bool) {
|
||||
_, err := os.Stat(filename)
|
||||
if err != nil {
|
||||
result = os.IsNotExist(err)
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
if result == false {
|
||||
behaivor.Anxiety("Error checking the existence of the file", err)
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
// Create a file with truncated data
|
||||
func MustCreate(filename string) {
|
||||
file, err := os.Create(filename)
|
||||
behaivor.Anxiety("File creating error", err)
|
||||
file.Close()
|
||||
}
|
||||
Reference in New Issue
Block a user