CodeSampleX

Exemplo

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

sha256:954bc2ff01bf4b96daeaccb729ef1f85f49879567953a11823b340a25842f1dc

Estado de publicação. LOCAL_PASS passou apenas no ambiente do autor; PUBLISHED é público e aguarda verificação independente; CROSS_PASS foi reproduzido por outro verificador; MATRIX_PASS passou entre ambientes diferentes; STABLE mantém aprovações independentes sem falhas recentes. Força da evidência. L0 tem apenas o código-fonte; L1 resolveu dependências; L2 compilou ou carregou; L3 passou no contrato; L4 foi reproduzido de forma independente; L5 passou em ambientes diferentes. MIT-0

Evidência de execução

O ambiente declarado é separado das execuções assinadas para mostrar exatamente o que foi provado.

Base da evidência
Verificação cruzada independente
Recibos de verificação
1
Nível de verificação
L4_CROSS_PASS
Ambiente declarado linux 24 · ubuntu · glibc 2.39 x64 go

Ambientes das execuções de verificação

Ambiente Contrato Etapas Execução
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
Pacotes
Símbolos
  • Validate.RegisterValidation
Criado
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

Arquivos

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

Baixar o artefato de código-fonte (tar.gz)

Seeder de origem

anônimo