18 lines
225 B
Go
18 lines
225 B
Go
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)
|
|
}
|