Ejemplo
omitempty does not omit zero-value structs or zero time.Time and does not omit non-nil pointers to zero values, but omits both nil and empty slices
sha256:bc28421aeb3987f9f08eb71bdb73b5ee10e20ed8f2faa88b5c6f2d6b650d055c
PUBLISHED
L3_CONTRACT_PASS
MIT-0
Caso
- Objetivo
- omitempty does not omit zero-value structs or zero time.Time and does not omit non-nil pointers to zero values, but omits both nil and empty slices HOW
- Paquetes
- encoding/json 1.26.5
- Entorno
- go
- Creado
- 2026-08-15T17:13:14Z
Contrato
- assert zero-value struct with omitempty is marshaled and not omitted
- assert zero time.Time with omitempty is marshaled as RFC3339 zero timestamp and not omitted
- assert non-nil pointer to zero value with omitempty is marshaled and not omitted
- assert nil pointer with omitempty is omitted
- assert both nil and empty slices with omitempty are omitted
- assert without omitempty nil slice marshals to null and empty slice marshals to empty array
Archivos
- .gitignore
- NOTES.md
- csx.json
- go.mod
- omitempty_test.go
Descargar el artefacto verificado (tar.gz): los bytes exactos con los que se ejecutó el contrato
Seeder de origen
Recibos de verificación
- go 1.26 · CONTAINER_RUN · compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS · golang@1 · 2026-08-15 · ed25519:d91480838ac982c9