Skip to content

Releases: syssam/go-validator

v1.5.0

30 May 10:59
5b0fb32

Choose a tag to compare

Correctness, concurrency, performance, and security release.

⚠️ Behavior changes (read before upgrading)

  • Untagged nested structs/pointers are now validated recursively (time.Time/decimal.Decimal still treated as scalars).
  • Duplicate errors removed — one error per field.
  • FieldError.FuncError is now json:"-".

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 FailFast option; CI hardened (Go matrix, race, lint v2, fuzz); coverage 78%→88%.

Full details in CHANGELOG.md.

v1.4.0

04 Jan 12:21

Choose a tag to compare

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.crypto for crypto-only validation
  • currency validates 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

04 Jan 06:57

Choose a tag to compare

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

27 Oct 08:37

Choose a tag to compare

add uuid3, uuid4, uuid5, uuid

v1.1

30 Mar 08:49

Choose a tag to compare

added FieldErrors
fixed TestInnerStruct2

v1.0

07 Feb 11:27
c1134a5

Choose a tag to compare

Update .travis.yml

added go v.1.12, v1.13, v1.14 testing

v1.0-alpha.3

17 Jun 01:50

Choose a tag to compare

v1.0-alpha.2

25 Aug 14:36

Choose a tag to compare

v1.0-alpha.2 Pre-release
Pre-release
change message placeholder name