サンプル
Enabling Decoder.KnownFields(true) returns a yaml.TypeError when unmarshaling unknown keys, embedded struct fields missing yaml:",inline", or yaml:"-" ignored fields.
sha256:b6ff37d02e3e29da45e029812c5d21bf74b02359da326c1e17829bd0fc6a7bf6
PUBLISHED
L3_CONTRACT_PASS
MIT-0
実行証拠
宣言環境と署名済み検証実行を分け、証明範囲を明確にします。
証拠の基準署名済みコントラクト合格
検証レシート1
検証レベルL3_CONTRACT_PASS
宣言された環境
- 実行コンテキスト
- go
- OS
- linux
- アーキテクチャ
- x64
- ランタイム
- go
- 言語
- go
- パッケージマネージャー
- go
検証実行環境
- 実行コンテキスト
- go 1.26
- OS
- linux alpine · musl
- アーキテクチャ
- x64
- ランタイム
- go 1.26
- 言語
- go
- パッケージマネージャー
- go
- 実行方式
- container · docker
CONTAINER_RUN · compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS · golang@1 · 2026-08-17
ケース
- ゴール
- Enabling Decoder.KnownFields(true) returns a yaml.TypeError when unmarshaling unknown keys, embedded struct fields missing yaml:",inline", or yaml:"-" ignored fields. HOW
- パッケージ
-
gopkg.in/yaml.v3 v3.0.1
- 環境
- go
- 作成日
- 2026-08-17T17:07:23Z
よくある思い込み
yaml.Decoder.Decode ignores unrecognized keys by default, and developers expecting encoding/json semantics assume embedded anonymous struct fields are automatically inlined without explicit tags.
このサンプルの作者が、ここで開発者やモデルが期待するであろうこととして記録したもの。下の契約が実際に実行されたものだ。
コントラクト
- Enabling yaml.Decoder.KnownFields(true) returns a *yaml.TypeError reporting 'field <name> not found' for undeclared keys, un-inlined embedded struct fields, and yaml:"-" ignored fields, whereas default decoding silently discards them without error.
- Default yaml.Unmarshal or Decoder without KnownFields silently drops unknown keys and un-tagged embedded fields, returning a nil error.
- Decoder.Decode with KnownFields(true) returns a *yaml.TypeError containing line numbers and field names when encountering unknown keys.
- Embedded anonymous structs require an explicit yaml:",inline" tag to be decoded under KnownFields(true), otherwise their fields are rejected as unknown fields.
- Fields tagged with yaml:"-" are treated as unknown fields and rejected under KnownFields(true) when present in YAML input.
- Field tag matching under KnownFields(true) is case-sensitive, rejecting uppercase or mismatched keys with a *yaml.TypeError.
ファイル
- NOTES.md
- csx.json
- go.mod
- go.sum
- yaml_config_test.go
ソースアーティファクトをダウンロード (tar.gz)
オリジンシーダー
csx-seed
検証レシート
- go 1.26 · linux alpine/x64 · docker · CONTAINER_RUN · compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS · golang@1 · 2026-08-17 · ed25519:d91480838ac982c9