CodeSampleX

Ejemplo

Register and execute custom field validation with parameters using RegisterValidation in go-playground/validator

sha256:954bc2ff01bf4b96daeaccb729ef1f85f49879567953a11823b340a25842f1dc

Estado de publicación. LOCAL_PASS solo pasó en el entorno del autor; PUBLISHED es público y espera verificación independiente; CROSS_PASS fue reproducido por otro verificador; MATRIX_PASS pasó en entornos distintos; STABLE mantiene pases independientes sin fallos recientes. Fuerza de la evidencia. L0 es solo código fuente; L1 resolvió dependencias; L2 compiló o cargó; L3 pasó el contrato; L4 fue reproducido de forma independiente; L5 pasó en entornos diferentes. MIT-0

Evidencia de ejecución

Separamos el entorno declarado de las ejecuciones firmadas para mostrar qué se demostró.

Base de evidencia
Verificación cruzada independiente
Recibos de verificación
1
Nivel de verificación
L4_CROSS_PASS
Entorno declarado linux 24 · ubuntu · glibc 2.39 x64 go

Entornos de las ejecuciones de verificación

Entorno Contrato Etapas Ejecución
go 1.26 · linux alpine/x64 · docker ed25519:c1973797be207ac4 PASS compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS
CONTAINER_RUN · golang@1
2026-08-21

Caso

HOW
Objetivo
Register and execute custom field validation with parameters using RegisterValidation in go-playground/validator
Paquetes
Símbolos
  • Validate.RegisterValidation
Creado
2026-08-21T03:13:44Z

Contrato

  1. validate.RegisterValidation registers a custom validation function that receives tag parameters via FieldLevel.Param()
  2. Struct field validation succeeds when the field value matches the parameter prefix rule defined in the custom tag
  3. Struct field validation fails with ValidationErrors indicating the custom tag name when the field value violates the parameter prefix rule

Archivos

  • PROMPT.md
  • csx.json
  • go.mod
  • go.sum
  • main.go
  • spec.json
  • test/contract.go

Descargar el artefacto de código fuente (tar.gz)

Seeder de origen

anónimo