Add panic
This commit is contained in:
17
panic/panic.go
Normal file
17
panic/panic.go
Normal 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)
|
||||
}
|
||||
Reference in New Issue
Block a user