Skip to content

Commit ceffc49

Browse files
authored
Small update on examples in the documentation. (#157)
# Describe Request Small update on examples in the documentation. # Change Type Documentation improvements.
1 parent 72272ff commit ceffc49

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

v2/README.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -164,13 +164,13 @@ When adding checker struct tags to a slice, you can use the `@` prefix to indica
164164
```golang
165165
type Person struct {
166166
Name string `checkers:"required"`
167-
Emails []string `checkers:"@max-len:1 max-len:4"`
167+
Emails []string `checkers:"@max-len:2 max-len:64"`
168168
}
169169
```
170170

171171
In this example:
172-
- `@max-len:1` ensures that the `Emails` slice itself has at most one item.
173-
- `max-len:4` ensures that each email string within the `Emails` slice has a maximum length of 4 characters.
172+
- `@max-len:2` ensures that the `Emails` slice itself has at most two items.
173+
- `max-len:64` ensures that each email string within the `Emails` slice has a maximum length of 64 characters.
174174

175175
# Localized Error Messages
176176

@@ -192,7 +192,7 @@ checker.RegisterLocale(locales.DeDE, locales.DeDEMessages)
192192

193193
_, err := checker.IsEmail("abcd")
194194
if err != nil {
195-
fmt.Println(err)
195+
fmt.Println(err.ErrorWithLocale(locales.DeDE))
196196
// Output: Keine gültige E-Mail-Adresse.
197197
}
198198
```
@@ -217,7 +217,7 @@ Error messages are generated using Golang template functions, allowing them to i
217217
err := NewCheckErrorWithData(
218218
"NOT_FRUIT",
219219
map[string]interface{}{
220-
"name": name,
220+
"name": "abcd",
221221
},
222222
)
223223

0 commit comments

Comments
 (0)