mirror of
https://github.com/teivah/100-go-mistakes.git
synced 2026-06-21 00:47:11 +08:00
Merge 7b76ea932f into c13d0b4807
This commit is contained in:
commit
3adc114947
1 changed files with 1 additions and 1 deletions
|
|
@ -1178,7 +1178,7 @@ When handling an error, we can decide to wrap it. Wrapping is about adding addit
|
|||
|
||||
???+ info "TL;DR"
|
||||
|
||||
If you use Go 1.13 error wrapping with the `%w` directive and `fmt.Errorf`, comparing an error against or a value has to be done using `errors.As`. Otherwise, if the returned error you want to check is wrapped, it will fail the checks.
|
||||
If you use Go 1.13 error wrapping with the `%w` directive and `fmt.Errorf`, comparing an error against a value has to be done using `errors.Is`. Otherwise, if the returned error you want to check is wrapped, it will fail the checks.
|
||||
|
||||
A sentinel error is an error defined as a global variable:
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue