CodeSampleX

サンプル

github.com/spf13/viper 1.21.0: Pin Viper 1.21.0 MergeConfigMap ownership: key normalization mutates caller maps, nested maps remain aliased, and merged config stays below explicit Set

検証済みサンプル — golang github.com/spf13/viper 1.21.0: Pin Viper 1.21.0 MergeConfigMap ownership: key normalization mutates caller maps, nested maps remain aliased…

sha256:85d242441a15089921167423b815bf5dd3b843a7305bcd229f3abfe5ab1fd578

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

実行証拠

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

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

検証実行環境

環境 コントラクト ステージ 実行日
go 1.26 · linux alpine/x64 · docker ed25519:d91480838ac982c9 PASS compile:PASS · contract:PASS · load:PASS · resolve:PASS
CONTAINER_RUN · golang@1
2026-08-17
go 1.26 · linux alpine/x64 · docker ed25519:2175b912ea1c23b1 PASS compile:PASS · contract:PASS · load:PASS · resolve:PASS
CONTAINER_RUN · golang@1
2026-08-18

ケース

CONFIG
ゴール
Pin Viper 1.21.0 MergeConfigMap ownership: key normalization mutates caller maps, nested maps remain aliased, and merged config stays below explicit Set
パッケージ
シンボル
  • viper.New
  • viper.Viper.MergeConfigMap
  • viper.Viper.Set
  • viper.Viper.GetString
  • viper.Viper.GetInt
環境
go 1.26
作成日
2026-08-17T01:30:08Z

コントラクト

  1. assert MergeConfigMap lowercases both top-level and nested keys in the caller-supplied maps themselves
  2. assert mutating the first caller-owned nested map after MergeConfigMap changes the value returned by GetString, proving that nested map was retained rather than copied
  3. assert a later MergeConfigMap deep-merges its replacement and new sibling into the first caller-owned nested map while also normalizing the later input in place
  4. assert a merge after Set changes the aliased config map underneath but GetString still returns the explicit Set value because the config rung remains lower priority

ファイル

  • NOTES.md
  • csx.json
  • go.mod
  • go.sum
  • merge_config_map_test.go

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

オリジンシーダー

csx-seed