chore(deps): Update module github.com/gookit/validate to v2#103
Open
renovate[bot] wants to merge 1 commit into
Open
chore(deps): Update module github.com/gookit/validate to v2#103renovate[bot] wants to merge 1 commit into
renovate[bot] wants to merge 1 commit into
Conversation
f98a418 to
533c5e2
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR contains the following updates:
v1.6.0→v2.0.1Release Notes
gookit/validate (github.com/gookit/validate)
v2.0.1Compare Source
Change Log
Refactor
d90d91c5a89ab1c69fc22d079b28aeab5ee7352c7f7fbd72164b2429Feature
bd9890380805f9854da39Update
db65592e0351f4503863d95431c1b60f8beOther
526044917dd47f63092bfc4088a08f63bfa59e87c01516f07v2.0.0Compare Source
v2.0 keeps breaking changes intentionally minimal (5 items). Core API,
validator names, tag semantics and the
DataFaceinterface are unchanged — mostprojects upgrade by bumping the import path to
/v2. Seedocs/UPGRADE-v2.md for the full migration guide.
Breaking Changes
github.com/gookit/validate→github.com/gookit/validate/v2(per Go Modules semantic import versioning). Update both
go getand allimportlines.go.mod).BetweensignatureBetween(val any, min, max int64)→Between(val, min, max any), now consistent withGt/LtviavalueCompare(supports int / uint / float / string). Semantic change for fractional bounds:
Between(2.9, 1, 2)wastrue(int64 truncation) and is nowfalse(no moretruncation). Tag/
StringRuleusage likebetween:1,2is unaffected.ValueLen(v)— use goutil'sreflects.Len(v)instead.validatetag.Previously a sub-struct field (struct /
*struct/ slice-of-struct /map-of-struct) was always descended into to collect its inner rules. Now
(
CheckSubOnParentMarkeddefaults to true) cascade only happens when theparent field has a
validatetag — the value may be empty (validate:""is enough to mark it); a named field with no
validatetag is nolonger descended into (Java
@Valid-style opt-in). Anonymous embeddedstructs (e.g.
type Bar struct { Foo }) are exempt — they are part ofthe parent and always cascade regardless of tag; only named sub-struct
fields require the tag. To restore the v1 "always cascade" behavior globally:
validate.Config(func(o *validate.GlobalOption){ o.CheckSubOnParentMarked = false }).See docs/UPGRADE-v2.md for migration details.
New Features
AddCustomType(fn CustomTypeFunc, types ...any)— register an underlyingvalue extractor for custom/wrapped types (e.g.
sql.NullString, money types).The extracted value flows through the existing validation paths (
required/numeric compare / length / string rules).
CustomTypeFunc func(field reflect.Value) any; returningnilis treated as empty. Mirrorsgo-playground/validator's
RegisterCustomTypeFunc.ResetCustomTypes()clearsthe registry. Zero overhead on the hot path when nothing is registered (atomic
gate short-circuit).
NewFactory()+Factory.Struct/Factory.Map+(*Validation).Release()— opt-in pooled factory that reuses
*Validationinstances across manysame-type validations, amortizing construction cost (allocs roughly halved in
reuse scenarios). Non-default:
Struct/Map/Newbehavior and lifecycleare unchanged.
Performance
Measured on Go 1.25 (count=6) against the v1.6.0 final:
Coverage 95.7% (v1.6.0 was 95.6%).
Internal
convertArgsType).validators.goby category (compare / string / type files).fieldValueintointernal/(reflectx,fieldval).Configuration
📅 Schedule: (UTC)
🚦 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.
This PR was generated by Mend Renovate. View the repository job log.