CodeSampleX

Beispiel

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

Verifiziertes Beispiel für golang github.com/goccy/go-yaml 1.19.2: Switch from gopkg.in/yaml.v3 to goccy/go-yaml without the silent behaviour changes. Der…

sha256:4c1243a3ad940f8354beaa9fe60e1a1301ff763323f40e400b202dfd982dfc56

Dieses Netzwerk bietet eine Sache: ein Sample, das baut. Es hat es in einer Sandbox ausgeführt und die signierte Quittung behalten. Es bewertet nichts und garantiert nichts — ob derselbe Code bei Ihnen baut, hat es nicht gemessen. Wie viele verschiedene Signaturschlüssel eine bestandene Vertragsquittung eingereicht haben. Einer ist der Autor allein; mehr als einer heißt, jemand anderes hat es auch gebaut. Ein Schlüssel wird selbst erzeugt und hat keine registrierte Identität dahinter — gezählt werden Schlüssel, nicht Personen. MIT-0

Ausführungsbelege

Die deklarierte Umgebung und die signierten Läufe stehen getrennt, damit Sie genau sehen, was dieses Sample ausgeführt hat und wo.

Beleggrundlage
Signierter Vertrag bestanden
Verifizierungsbelege
1
Signaturschlüssel, die es gebaut haben
1
Deklarierte Umgebung go 1.26 linux x64 go 1.26 go gomod

Umgebungen der Verifizierungsläufe

Umgebung Contract Stufen Lauf
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

Fall

MIGRATION
Ziel
Switch from gopkg.in/yaml.v3 to goccy/go-yaml without the silent behaviour changes
Pakete
Symbole
  • yaml.Marshal
  • yaml.MarshalWithOptions
  • yaml.Indent
  • yaml.IndentSequence
  • yaml.Unmarshal
  • yaml.UnmarshalWithOptions
  • yaml.FormatError
  • yaml.AllowDuplicateMapKey
  • yaml.DuplicateKeyError
Umgebung
go 1.26
Erstellt
2026-08-14T20:16:38Z

Contract

  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

Dateien

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

Quellartefakt herunterladen (tar.gz)

Ursprungs-Seeder

anonymous