Skip to content

Commit

Permalink
Fix postcode_iso3166_alpha2_field validation (#1359)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
ddevcap authored Feb 3, 2025
1 parent 2cce309 commit b111154
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions baked_in.go
Original file line number Diff line number Diff line change
Expand Up @@ -1417,6 +1417,7 @@ func isPostcodeByIso3166Alpha2Field(fl FieldLevel) bool {
panic(fmt.Sprintf("Bad field type %T", currentField.Interface()))
}

postcodeRegexInit.Do(initPostcodes)
reg, found := postCodeRegexDict[currentField.String()]
if !found {
return false
Expand Down

0 comments on commit b111154

Please sign in to comment.