mirror of
https://github.com/golang/go.git
synced 2025-05-05 15:43:04 +00:00
Changed a syntax error to valid Go code
parent
7c8842f897
commit
6ce7a0f8c2
@ -26,7 +26,8 @@ You need to be prepared that errors you get may be wrapped.
|
||||
```
|
||||
becomes
|
||||
```
|
||||
if e := &os.PathError{}; xerrors.As(err, &e)
|
||||
e := &os.PathError{}
|
||||
if xerrors.As(err, &e)
|
||||
```
|
||||
- Also use this pattern to check whether an error implements an interface. (This is one of those rare cases when a pointer to an interface is appropriate.)
|
||||
- Rewrite a type switch as a sequence of if-elses.
|
||||
|
Loading…
x
Reference in New Issue
Block a user