From 7b76ea932f60add7eacca2f9411f07583f8381d5 Mon Sep 17 00:00:00 2001 From: albertchae <217050+albertchae@users.noreply.github.com> Date: Sun, 21 Sep 2025 12:47:01 -0700 Subject: [PATCH] Fix TLDR for #51 Comparing an error value inaccurately Both the text and [example source code](https://github.com/teivah/100-go-mistakes/blob/master/src/07-error-management/51-comparing-error-value/main.go) reference `errors.Is`, so I'm guessing this is copy pasta from `50 Comparing an error type inaccurately`? --- docs/index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/index.md b/docs/index.md index 50fbd97..c61cb79 100644 --- a/docs/index.md +++ b/docs/index.md @@ -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: