Skip to content

Commit 6ffa5d1

Browse files
joeybloggsjoeybloggs
authored andcommitted
add thread safety note to AddFunction and SetTag functions
1 parent 8c2248a commit 6ffa5d1

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

validator.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,12 +195,14 @@ func New(tagName string, funcs map[string]Func) *Validate {
195195

196196
// SetTag sets tagName of the Validator to one of your choosing after creation
197197
// perhaps to dodge a tag name conflict in a specific section of code
198+
// NOTE: this method is not thread-safe
198199
func (v *Validate) SetTag(tagName string) {
199200
v.tagName = tagName
200201
}
201202

202203
// AddFunction adds a validation Func to a Validate's map of validators denoted by the key
203204
// NOTE: if the key already exists, it will get replaced.
205+
// NOTE: this method is not thread-safe
204206
func (v *Validate) AddFunction(key string, f Func) error {
205207

206208
if len(key) == 0 {

0 commit comments

Comments
 (0)