update to README.md

master
Charles Iliya Krempeaux 2024-07-04 07:53:50 -07:00
parent 271465c401
commit 0485e21eaa
1 changed files with 7 additions and 2 deletions

View File

@ -15,12 +15,17 @@ Online documentation, which includes examples, can be found at: http://godoc.org
There are two ways to create errors — There are two ways to create errors —
With `erorr.Error`: With `erorr.Error`:
``` ```
const err error = erorr.Error("internal-error") const err error = erorr.Error("internal-error")
``` ```
**NOTICE THAT THAT ERROR IS A `const` RATHER THAN A `var`.**
**Errors creating using `erorr.Error` can be a Go `const`.**
And with `erorr.Errorf`: And with `erorr.Errorf`:
``` ```
var err error = erorr.Errorf("bad value for id %q", id) var err error = erorr.Errorf("bad value for id %q", id)
``` ```
**One thing to notice is that `erorr.Error` errors can be a Go `const`.**