GoForge — Build | Test | Ship | Collaborate GoForge — Build | Test | Ship | Collaborate
v1.0.3

Validator

Validation that retains evidence

$ go get goforge.dev/gpvalidator@v1.0.3

Current release — v1.0.3. goforge.dev/gpvalidator is at 100% feature parity with go-playground/validator v10.30.3 (106/106 declarations, 210/210 behaviors), differential + fuzz + property tested, race/vet clean, and consumes Go+ stdlib v0.207.0. Install with go get goforge.dev/gpvalidator@v1.0.3.

GoForge Validator targets go-playground/validator v10.30.3. Existing tags can cross a compatibility adapter while new code uses typed, composable Go+ rules with structured failures and successful predicate witnesses.

Current parity

The reproducible public inventory contains 106 declarations across the root and 22 translation packages, and all 106 are present. Exported methods on unexported internal receiver types are excluded because consumers cannot name those types. Implemented slices include context-aware entry points, cross-value validation, keyed and nested-map validation, tag/name configuration, selective validation, map namespace traversal, and namespace filtering. A separate reproducible The reproducible 210-row behavior inventory records all 210 behaviors as present. Character classes, string relations, case rules, numeric/boolean recognition, and JSON validation are differentially covered. All twelve field/cross-struct comparison tags are covered across dotted paths, missing and mismatched peers, collections, strings, and time values. Registered custom scalar conversions and automatic Valuer extraction are also covered, along with context-aware custom validators and the complete public FieldLevel method surface. Pure host and service identifiers now include RFC 952/1123 hostnames, FQDNs, RFC 1035 labels, BIC 2014/2022, SpiceDB names, origins, and URL encoding. Markup and presentation formats include HTML, encoded HTML, data URIs, the RGB/HSL/CMYK color families, the built-in iscolor alias, and general pipe-separated validator alternatives. URI and URL variants, HTTP(S)-restricted URLs, layout-driven datetimes, IANA timezone names, and cron expressions are also differentially covered. Resolvable IPv4, IPv6, generic IP, TCP, UDP, and Unix address validators match upstream’s parse-before-resolution behavior. Filesystem coverage includes files, directories, prospective paths, MIME detection and wildcards, image detection, and live Unix-domain sockets. Ethereum, Bitcoin Base58Check/Bech32, MongoDB connection strings, and RFC 2141 URNs are differentially covered as well. BCP 47 language tags and pinned ISO 3166/4217 country, subdivision, currency, EU-subset, and numeric catalogs are generated reproducibly into Go+ source and checked exhaustively against upstream. Per-struct map-rule overrides and context-aware struct-level callbacks—with ordered error reporting and imported nested errors—are also differentially covered. Translator registration, per-error/namespaced translation, and all 22 packaged locale catalogs are differentially covered. Private-field validation is available only through the same explicit unsafe-reflection opt-in as upstream. Malformed tags and invalid traversal retain upstream panic behavior by default, including exact diagnostics for tag compilation, numeric parameters, container traversal, and restricted registrations; WithSafeInvalidValidation is a GoForge extension for callers that prefer explicit compile/traversal errors. Scalar comparison plans preserve upstream’s kind-specific behavior for string literals, booleans, Unicode and collection lengths, numeric values, durations, and relative time.Time ordering. The manifest-driven diagnostic gate compares all 181 validators across 15 Go value shapes, then checks missing and extraneous parameters separately: 3,077 upstream comparisons with exact panic and returned-error surfaces. Map-key rules using dive,keys,…,endkeys,… are now differentially covered for built-in and custom validators, including recursively nested dives through comparable array keys. Malformed placement, dangling keys, and redundant endkeys behavior is differentially covered. omitempty, omitnil, and omitzero retain upstream’s distinct treatment of nil values, non-nil pointers, and empty-but-non-nil collections. Encoding and identifier coverage now includes Base32/Base64 variants, hexadecimal colors and digests, JWT lexical structure, ULIDs, and SemVer 2.0, implemented as allocation-conscious scanners rather than runtime regexes. Pure network and coordinate validation now covers IP and CIDR families, MAC, E.164, hostname/port pairs, unsigned ports, latitude, and longitude without performing DNS or filesystem probes. The UUID version/RFC family, negative and case-insensitive set membership, printable/multibyte checks, and sibling-field containment relations are also differentially covered. Presence/default checks preserve raw pointer provenance, matching upstream for non-nil pointers to zero and empty-but-non-nil collections. All conditional required_*, excluded_*, and skip_unless forms are covered across multi-field polarity, typed comparisons, dotted paths, and nil/length sentinels. unique covers arrays, slices, map values, pointers/nils, projected struct fields, and sibling fields; its small primitive path exceeds both Wave 1 performance targets. ISBN, ISSN, Luhn, and credit-card checksum validation use direct arithmetic; the grouped credit-card path is 5.21× faster and removes all upstream allocations. RIPEMD/Tiger digests, MongoDB object IDs, EIN, SSN, and CVE identifiers are covered by the same direct-scanner approach.

Go+ and standard library

The current adapter is authored in validator.gp and reproducibly generates version-marked Go. Validation[T] exhaustively separates Valid(value), Invalid(value, violations), and InvalidCall(error).

std/validate provides indexed rules, paths, ordered failure trees, witnesses, conjunction, ordinary-Go guards, and reflection-free cross-value Pair and Relate rules. Failure.Descriptor() now exposes stable, localization-neutral code/parameter keys while locale registries remain outside the semantic core.

Performance

The typed core is 3.7–7.8× faster on recorded field/struct workloads, with failure allocations reduced 66.7–71.4% and success remaining zero-allocation. Cross-value success is currently 2.84× faster and zero-allocation. Cross-value failure and the remaining selective/filtered compatibility paths stay explicitly below target and cannot be hidden by the faster semantic core. The common single-field StructPartial failure path now clears both gates at 2.02× faster with 62.5% fewer allocations. Multi-field StructExcept now uses 50% fewer allocations at 1.60× throughput; callback-driven StructFiltered remains open.

Release gate

The release requires all 106 public declarations and documented behaviors, complete differential coverage, no unresolved performance ledger items, released matching Go+/stdlib tags, clean external module resolution, and a pull immediately before tagging.