CodeSampleX

Exemple

github.com/goccy/go-yaml 1.19.2: Switch from gopkg.in/yaml.v3 to goccy/go-yaml without the silent behaviour changes

Échantillon vérifié pour golang github.com/goccy/go-yaml 1.19.2: Switch from gopkg.in/yaml.v3 to goccy/go-yaml without the silent behaviour changes. Le…

sha256:4c1243a3ad940f8354beaa9fe60e1a1301ff763323f40e400b202dfd982dfc56

Ce réseau offre une seule chose : un échantillon qui compile. Il l'a exécuté dans un bac à sable et conservé le reçu signé. Il ne note rien et ne garantit rien : si le même code compile chez vous, il ne l'a pas mesuré. Combien de clés de signature distinctes ont déposé un reçu de contrat réussi. Une seule, c'est l'auteur ; plus d'une signifie que quelqu'un d'autre l'a compilé aussi. Une clé est auto-générée sans identité enregistrée derrière, donc on compte des clés, pas des personnes. MIT-0

Preuves d'exécution

L'environnement déclaré et les exécutions signées sont séparés, pour que vous voyiez exactement ce que cet échantillon a exécuté et où.

Base de preuve
Contrat signé réussi
Reçus de vérification
1
Clés de signature qui l’ont compilé
1
Environnement déclaré go 1.26 linux x64 go 1.26 go gomod

Environnements des exécutions de vérification

Environnement Contrat Étapes Exécution
go 1.26 · linux alpine/x64 · docker ed25519:a2ec939a4c60e243 PASS compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS
CONTAINER_RUN · go@1
2026-08-14

Cas

MIGRATION
Objectif
Switch from gopkg.in/yaml.v3 to goccy/go-yaml without the silent behaviour changes
Paquets
Symboles
  • yaml.Marshal
  • yaml.MarshalWithOptions
  • yaml.Indent
  • yaml.IndentSequence
  • yaml.Unmarshal
  • yaml.UnmarshalWithOptions
  • yaml.FormatError
  • yaml.AllowDuplicateMapKey
  • yaml.DuplicateKeyError
Environnement
go 1.26
Créé
2026-08-14T20:16:38Z

Contrat

  1. assert the two libraries emit different bytes for the same value, two-space flush sequences vs four-space indented ones
  2. assert Indent(4) plus IndentSequence(true) reproduces the yaml.v3 layout exactly
  3. assert goccy decodes a positive integer into any as uint64 and a negative one as int64 where yaml.v3 gives int for both
  4. assert goccy err.Error() already embeds the caret-annotated source and FormatError with inclSource false strips it back to one line
  5. assert a duplicate mapping key is an error by default but does not match errors.As on yaml.DuplicateKeyError, and AllowDuplicateMapKey gives last-key-wins
  6. assert the alias struct tag only emits an alias for pointer fields sharing an address and is silently ignored on value fields

Fichiers

  • csx.json
  • go.mod
  • go.sum
  • src/yamlcompat.go
  • test/main.go

Télécharger l’artefact source (tar.gz)

Seeder d'origine

anonymous