Skip to content

Update module github.com/go-ozzo/ozzo-validation/v4 to v4.5.0 - #155

Open
renovate[bot] wants to merge 1 commit into
mainfrom
renovate/github.com-go-ozzo-ozzo-validation-v4-4.x
Open

renovate[bot] wants to merge 1 commit into
mainfrom
renovate/github.com-go-ozzo-ozzo-validation-v4-4.x

Conversation

@renovate

@renovate renovate Bot commented Aug 21, 2026 •

Copy link
Copy Markdown
Contributor

This PR contains the following updates:

Package Change Age Confidence
github.com/go-ozzo/ozzo-validation/v4 v4.3.0 → v4.5.0 age confidence

Release Notes

go-ozzo/ozzo-validation (github.com/go-ozzo/ozzo-validation/v4)

v4.5.0: — v4.3.0 empty-value semantics restored, errors.Is and Flatten, no-template build

Compare Source

This release restores the v4.3.0 behavior that v4.4.0 changed for empty values. It adds explicit opt-ins for the
cases v4.4.0 was meant to fix, and fixes the problems found in the unreleased changes before they ship.

Fixed
  • Restore the v4.3.0 empty-value semantics (#​234, reported
    by @​ldez). Two "Breaking Changes" of v4.4.0 are reverted:

    • a zero struct is no longer empty: only the zero time.Time is. This applies to every rule that checks for
      empty values. Required and NilOrNotEmpty pass again for a zero struct, and Required on a zero
      Validatable struct reports the struct's own field errors instead of "cannot be blank". Empty reports a zero
      struct as not empty again, and the rules that skip empty values (In, NotIn, Length, RuneLength, Date
      and the string rules, including is.*) validate a zero struct again. Each(Required) passes again for
      zero-struct elements;
    • Min()/Max() skip empty values again (0, 0.0, the zero time.Time), as their documentation says.

    To keep the v4.4 checks, use the new opt-ins below.

  • Errors.Error() no longer starts with "; " when the first sorted key holds a nil error. An Errors with only
    nil entries returns "", as an empty Errors does.

  • is.Latitude/is.Longitude are validation.StringRule again, as in v4.4.1, so code that holds them as a
    StringRule compiles. String input is validated exactly as in v4.4.1: "NaN", "1e1", "0x1p-2", "45." and
    ".5" are rejected. Numbers are accepted as introduced by
    #​223; NaN and infinities are rejected.

  • A missing map key never runs its rules with a nil value: rules written for the key's type, such as a By with a
    type assertion, no longer panic. The error stays "required key is missing" (validation_key_missing). Only a
    Required or NotNil rule with a custom message (Error/ErrorObject) reports its own error
    (#​222 by
    @​nguyenvantuan2391996, narrowed) — fixes
    #​134.

  • EnsureString(nil) returns an error instead of panicking
    (#​232 by @​yuefdev) — fixes
    #​233.

  • MultipleOf(0) returns an error instead of panicking with a division by zero
    (#​231 by @​SashaMIT);
    MultipleOf(nil) returns an error instead of panicking.

  • NotIn() compares with reflect.DeepEqual, as In() does: it no longer panics on uncomparable values such as
    []byte, and structs with pointer fields compare by the pointed-to values
    (#​229 by @​youdie006).

Added
  • ozzo_validation_no_template build tag: error messages are rendered without text/template, which removes it
    from the binary and makes it noticeably smaller. Built-in messages read the same; custom messages support only
    field placeholders such as {{.min}} and {{ .min }}. See the README
    (#​235 by @​ldez) — fixes
    #​230.

  • ThresholdRule.ValidateEmpty(): Min/Max also check empty values, e.g. Min(0).Exclusive().ValidateEmpty()
    rejects 0 (#​165,
    #​180).

  • EmptyChecker interface: a struct type defines when its value is empty
    (#​143).

  • StringRule.AllowNumber(): a string rule can also accept finite numbers.

  • is.Latitude/is.Longitude accept numbers (int, uint and float types)
    (#​223 by
    @​nguyenvantuan2391996) — fixes
    #​185.

  • DateRule.Location(): parse dates that carry no time zone in a given location; the default stays UTC
    (#​220 by
    @​nguyenvantuan2391996) — fixes
    #​166.

  • Errors.Is: errors.Is finds a matching error anywhere in validation.Errors, including nested maps, slices and
    structs (#​225 by
    @​ChrisJr404) — fixes #​116.

    #​225 also proposed Errors.As. It is not part of this release. With it, errors.As(err, &validation.Error)
    returned the first field's error for a map of field errors, and code that uses that call to tell a single error from
    a field map lost the field names. errors.As keeps reporting false for validation.Errors; use errors.Is or
    Flatten() to reach the individual errors.

  • ErrorObject.Is: a validation error matches a built-in error with the same code, so
    errors.Is(err, validation.ErrRequired) works, also for rules with a custom message such as
    Required.Error("..."). Give the sentinel errors of your own rules a code: an error with an empty code never
    matches.

  • Flatten(err), Errors.Flatten() and FieldError: a flat, sorted list of all field errors with the key path,
    code, rendered message and params, and the error itself in Err. Field() gives items.0.name, Pointer() gives
    the RFC 6901 pointer /items/0/name. Slice indexes sort numerically (items.2 before items.10). A single error
    that is not an Errors is one entry with no path. Check Err for an InternalError before sending Message to a
    client.

  • errors.Is and errors.As reach the error wrapped by NewInternalError.

  • README: "Empty Values", "Checking for an Error", "Listing Field Errors" and "Smaller Binaries" sections.

Changed
  • Go 1.21 or later is required (go 1.21 in go.mod), the minimum announced in
    #​207.
  • is.CurrencyCode uses an ISO 4217 list maintained in this module instead of govalidator's, which adds current
    codes such as VES and VED (#​224 by
    @​nguyenvantuan2391996) — fixes
    #​206.
  • testify v1.4.0 → v1.12.1 (test-only).
  • CI tests Go 1.21, oldstable and stable on Linux, and stable on Windows and macOS, with the race detector, with and
    without the ozzo_validation_no_template tag. It also builds and tests on 386, checks formatting and
    go mod tidy, and pins every tool version except govulncheck, which stays on the latest release by design so that
    the vulnerability data is current. One required check, "Test", gates all jobs.
  • Docs: the v4.4.0 behavior changes documented
    (#​228 by @​dw-kihara);
    updated in this release for the restored semantics.
  • Tests: coverage gaps closed (#​218 by
    @​nguyenvantuan2391996).
  • The committed coverage.out is removed; test outputs are ignored.
Install
go get github.com/go-ozzo/ozzo-validation/v4@v4.5.0

Full changelog: go-ozzo/ozzo-validation@v4.4.1...v4.5.0

v4.4.1: — Performance: 36% fewer allocations

Compare Source

Performance

Struct field offset cache eliminates repeated reflect.StructField allocations.

Benchmark v4.4.0 v4.4.1 Improvement
ValidateStruct (6 fields) 59 allocs, 4.7 KB, 6.7µs 38 allocs, 2.3 KB, 3.6µs -36% allocs, -50% memory, -46% time
ValidateWithConditional 34 allocs, 3.8µs 19 allocs, 1.7µs -44% allocs, -56% time

Also fixes benchmark to pre-compile regex (was inflating alloc count).

Full Changelog: go-ozzo/ozzo-validation@v4.4.0...v4.4.1

v4.4.0: — Revival Release

Compare Source

Revival release — ozzo-validation is actively maintained again after 6 years.

12 community PRs merged, maintainer bug fixes, modernized CI infrastructure.

Added

Fixed

  • E.164 phone validation now requires + prefix per ITU-T standard (#​208 by @​Yanhu007)
  • Domain regex allows uppercase in final character (#​197 by @​mhargrove)
  • Each() now passes pointers correctly to By() callbacks (#​160 by @​dane)
  • IsEmpty() treats all zero-valued structs as empty (#​144 by @​soranoba)
  • Errors.Error() no longer panics on nil values (#​212)
  • Min()/Max() now validate zero values instead of silently skipping them (#​212)
  • README install command, code examples, documentation

Breaking Changes

These are bug fixes — the old behavior was incorrect:

  • is.E164 rejects phone numbers without + prefix (spec-correct)
  • Each() with By() on pointer slices passes *T instead of T
  • IsEmpty() returns true for zero-valued structs (was only time.Time{})
  • Min()/Max() validate numeric zero and time.Time{} (were silently skipped)

Thank You

Thanks to all contributors who waited patiently — some PRs were open for 5+ years.
Special thanks to @​qiangxue for entrusting the project to new maintainers.


Configuration

📅 Schedule: (in timezone Asia/Tokyo)

  • Branch creation
    • "every weekday,every weekend"
  • Automerge
    • At any time (no schedule defined)

🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

♻ Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 Ignore: Close this PR and you won't be reminded about this update again.


  • If you want to rebase/retry this PR, check this box

This PR was generated by Mend Renovate. View the repository job log.

@renovate renovate Bot changed the title Update module github.com/go-ozzo/ozzo-validation/v4 to v4.4.1 Update module github.com/go-ozzo/ozzo-validation/v4 to v4.4.1 - autoclosed Aug 23, 2026
@renovate renovate Bot closed this Aug 23, 2026
@renovate
renovate Bot deleted the renovate/github.com-go-ozzo-ozzo-validation-v4-4.x branch August 23, 2026 14:30
@renovate renovate Bot changed the title Update module github.com/go-ozzo/ozzo-validation/v4 to v4.4.1 - autoclosed Update module github.com/go-ozzo/ozzo-validation/v4 to v4.4.1 Aug 28, 2026
@renovate renovate Bot reopened this Aug 28, 2026
@renovate
renovate Bot force-pushed the renovate/github.com-go-ozzo-ozzo-validation-v4-4.x branch 2 times, most recently from 37dc820 to c07ad57 Compare August 28, 2026 08:43
@renovate renovate Bot changed the title Update module github.com/go-ozzo/ozzo-validation/v4 to v4.4.1 Update module github.com/go-ozzo/ozzo-validation/v4 to v4.4.1 - autoclosed Aug 29, 2026
@renovate renovate Bot closed this Aug 29, 2026
@renovate renovate Bot changed the title Update module github.com/go-ozzo/ozzo-validation/v4 to v4.4.1 - autoclosed Update module github.com/go-ozzo/ozzo-validation/v4 to v4.4.1 Aug 31, 2026
@renovate renovate Bot reopened this Aug 31, 2026
@renovate
renovate Bot force-pushed the renovate/github.com-go-ozzo-ozzo-validation-v4-4.x branch 2 times, most recently from c07ad57 to 769271f Compare August 31, 2026 14:00
@renovate
renovate Bot force-pushed the renovate/github.com-go-ozzo-ozzo-validation-v4-4.x branch from 769271f to 7352a3a Compare October 27, 2026 19:40
@renovate renovate Bot changed the title Update module github.com/go-ozzo/ozzo-validation/v4 to v4.4.1 Update module github.com/go-ozzo/ozzo-validation/v4 to v4.5.0 Oct 27, 2026
@renovate

renovate Bot commented Oct 27, 2026

Copy link
Copy Markdown
Contributor Author

ℹ️ Artifact update notice

File name: go.mod

In order to perform the update(s) described in the table above, Renovate ran the go get command, which resulted in the following additional change(s):

  • 1 additional dependency was updated

Details:

Package Change
github.com/stretchr/testify v1.10.0 -> v1.12.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants