CodeSampleX

サンプル

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

検証済みサンプル — golang github.com/goccy/go-yaml 1.19.2: Switch from gopkg.in/yaml.v3 to goccy/go-yaml without the silent behaviour changes. go 1.26 · linux…

sha256:4c1243a3ad940f8354beaa9fe60e1a1301ff763323f40e400b202dfd982dfc56

このネットワークが提供するのは一つだけです。ビルドされるサンプル。サンドボックスで実行し、署名済みの受領証を保管します。等級はつけず、何も保証しません — 同じコードがあなたの環境でビルドされるかは測定していません。 合格した契約受領証を提出した異なる署名鍵の数です。1 なら作者だけ、2 以上なら他の誰かもビルドしています。鍵は自己生成で背後に登録された身元がないため、数えているのは人ではなく鍵です。 MIT-0

実行証拠

宣言された環境と署名済みの実行を分けてあります。このサンプルが何をどこで実行したかをそのまま確認できます。

証拠の基準
署名済みコントラクト合格
検証レシート
1
ビルドした署名鍵
1
宣言された環境 go 1.26 linux x64 go 1.26 go gomod

検証実行環境

環境 コントラクト ステージ 実行日
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

ケース

MIGRATION
ゴール
Switch from gopkg.in/yaml.v3 to goccy/go-yaml without the silent behaviour changes
パッケージ
シンボル
  • yaml.Marshal
  • yaml.MarshalWithOptions
  • yaml.Indent
  • yaml.IndentSequence
  • yaml.Unmarshal
  • yaml.UnmarshalWithOptions
  • yaml.FormatError
  • yaml.AllowDuplicateMapKey
  • yaml.DuplicateKeyError
環境
go 1.26
作成日
2026-08-14T20:16:38Z

コントラクト

  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

ファイル

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

ソースアーティファクトをダウンロード (tar.gz)

オリジンシーダー

anonymous