CodeSampleX

Exemplo

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

Amostra verificada para golang github.com/goccy/go-yaml 1.19.2: Switch from gopkg.in/yaml.v3 to goccy/go-yaml without the silent behaviour changes. O…

sha256:4c1243a3ad940f8354beaa9fe60e1a1301ff763323f40e400b202dfd982dfc56

Esta rede oferece uma coisa: uma amostra que compila. Ela a executou em um sandbox e guardou o recibo assinado. Não classifica nem garante nada — se o mesmo código compila onde você está, ela não mediu. Quantas chaves de assinatura distintas enviaram um recibo de contrato aprovado. Uma é só o autor; mais de uma significa que outra pessoa também o compilou. Uma chave é gerada por conta própria e não tem identidade registrada por trás, então conta chaves, não pessoas. MIT-0

Evidência de execução

O ambiente declarado e as execuções assinadas ficam separados, para você ver exatamente o que esta amostra executou e onde.

Base da evidência
Contrato assinado aprovado
Recibos de verificação
1
Chaves de assinatura que o compilaram
1
Ambiente declarado go 1.26 linux x64 go 1.26 go gomod

Ambientes das execuções de verificação

Ambiente Contrato Etapas Execução
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

Caso

MIGRATION
Objetivo
Switch from gopkg.in/yaml.v3 to goccy/go-yaml without the silent behaviour changes
Pacotes
Símbolos
  • yaml.Marshal
  • yaml.MarshalWithOptions
  • yaml.Indent
  • yaml.IndentSequence
  • yaml.Unmarshal
  • yaml.UnmarshalWithOptions
  • yaml.FormatError
  • yaml.AllowDuplicateMapKey
  • yaml.DuplicateKeyError
Ambiente
go 1.26
Criado
2026-08-14T20:16:38Z

Contrato

  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

Arquivos

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

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

Seeder de origem

anonymous