Skip to content

Commit b111154

Browse files
authored
Fix postcode_iso3166_alpha2_field validation (#1359)
Fixed an issue where the post codes regexes would not get initialised for postcode_iso3166_alpha2_field validation. ## Fixes Or Enhances **Make sure that you've checked the boxes below before you submit PR:** - [x] Tests exist or have been written that cover this particular change. @go-playground/validator-maintainers
1 parent 2cce309 commit b111154

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

baked_in.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1417,6 +1417,7 @@ func isPostcodeByIso3166Alpha2Field(fl FieldLevel) bool {
14171417
panic(fmt.Sprintf("Bad field type %T", currentField.Interface()))
14181418
}
14191419

1420+
postcodeRegexInit.Do(initPostcodes)
14201421
reg, found := postCodeRegexDict[currentField.String()]
14211422
if !found {
14221423
return false

0 commit comments

Comments
 (0)