Skip to content

Compare defined scalar values in required_if - #355

Merged
inhere merged 1 commit into
gookit:masterfrom
rupayon123:fix/required-if-defined-types-current-20261029
Oct 29, 2026
Merged

inhere merged 1 commit into
gookit:masterfrom
rupayon123:fix/required-if-defined-types-current-20261029

Conversation

@rupayon123

Copy link
Copy Markdown
Contributor

A single required_if literal misses dependencies whose Go type is a defined scalar. For example, type Status string with Status("member") allows an empty field under required_if:Mode,member, while the equivalent built-in string correctly requires it.

Reuse IsEqual after the existing literal conversion succeeds. This keeps the existing conversion and empty-value rules and aligns the single-literal path with the value comparison already used elsewhere.

Validated against current master b148b170 on Go 1.26.0 / macOS arm64:

  • Eleven failing regressions and seven controls become 18 passing cases.
  • Full coverage and race suites each pass 865 leaf tests, with no skips; vet, build, formatting, tidy and all 11 required benchmarks pass.
  • Public API comparisons preserve 4,968 built-in outcomes and eliminate 300 defined-type mismatches across 3,240 paired observations.
  • Configured lint reports the same 65 baseline diagnostics, and Staticcheck the same seven; the documented vet fallback passes. This is not a lint-clean claim.

Other supported runtime/OS combinations and hosted CI remain unverified locally.

@inhere
inhere merged commit ced5f33 into gookit:master Oct 29, 2026
11 checks passed
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.

2 participants