Add panic

This commit is contained in:
2024-05-01 18:39:16 +05:30
parent b2314b5f63
commit 36574bafdf
2 changed files with 21 additions and 2 deletions

17
panic/panic.go Normal file
View File

@@ -0,0 +1,17 @@
package panic
import (
"fmt"
"os"
)
func Panic() {
p := "/cantcreate.txt"
_, err := os.Open(p)
if err != nil {
panic(fmt.Errorf("omg error when creating file %w", err))
}
fmt.Printf("%s created somehow!\n", p)
}