๐ŸŽError Wrapping WorkshopWORKSHOP
1
2
3
4

Step 1

Write a `readFile(path string) error` function that simulates a file-not-found error using `errors.New("no such file")` and wraps it with `fmt.Errorf("readFile %s: %w", path, err)`. In main, call it, print the full error message, and use `errors.Is` to check if the underlying error is `errNotFound`.

โŒ˜ Enter (Mac) ยท Ctrl+Enter (Win/Linux)