Releases: syssam/go-validator
Releases · syssam/go-validator
v1.5.0
Correctness, concurrency, performance, and security release.
⚠️ Behavior changes (read before upgrading)
- Untagged nested structs/pointers are now validated recursively (
time.Time/decimal.Decimalstill treated as scalars). - Duplicate errors removed — one error per field.
FieldError.FuncErroris nowjson:"-".
Highlights
- Fixed a data race + unbounded memory growth in
requiredIf. - Fixed
O(2^depth)nested validation + duplicate errors (field-cache bug). - Guarded cyclic references (depth limit) — no more infinite hang.
- Embedded (anonymous) struct fields are now validated.
- Allocation-free, ~2.5× faster success path.
- ReDoS-safe (RE2) and fuzzed (~6.6M execs, zero crashes).
- New
FailFastoption; CI hardened (Go matrix, race, lint v2, fuzz); coverage 78%→88%.
Full details in CHANGELOG.md.
v1.4.0
What's New
Locale Validation Rules
- Country codes (ISO 3166-1):
country,country.alpha2,country.alpha3,country.numeric - Currency codes (ISO 4217 + Crypto):
currency,currency.fiat,currency.crypto,currency.all - Language codes (ISO 639):
language,language.alpha2,language.alpha3 - Phone validation:
phone,phone.e164(using phonenumbers library)
Cryptocurrency Support
- Added 100+ cryptocurrency codes (BTC, ETH, USDT, SOL, etc.)
currency.cryptofor crypto-only validationcurrencyvalidates both fiat and crypto
Breaking Changes
- Now requires Go 1.23+ (due to phonenumbers library dependency)
Example Usage
type Payment struct {
Country string `valid:"required,country.alpha2"`
Currency string `valid:"required,currency"` // fiat or crypto
FiatOnly string `valid:"required,currency.fiat"` // fiat only
CryptoOnly string `valid:"required,currency.crypto"` // crypto only
Language string `valid:"required,language.alpha2"`
Phone string `valid:"required,phone.e164"`
}v1.3 - Code Consolidation & API Improvements
Breaking Changes
- Add generic functions
- Change func name pattern
ValidateGte→IsGte
Performance Improvements
- ~14% faster validation (BenchmarkGo119Performance)
- ~44% fewer memory allocations
- ~34% less memory usage
- Fixed Empty() to use IsZero() instead of DeepEqual()
Code Quality
- Consolidated field comparison functions with unified helper
- Added deref() helper to reduce code duplication
- Net code reduction: ~320 lines
- Updated README with better organization
v1.2
v1.1
v1.0
v1.0-alpha.3
Add Simple Translation
https://github.com/syssam/go-validator/tree/master/_examples/translation
v1.0-alpha.2
change message placeholder name