Go / Nested leaf merge

Go Struct Literal Leaf Merge

This page has a stable URL for review, documentation, and implementation comparison. The fixture tabs show merge inputs and output; the contract tabs show JSON and compact ruleset renderings with stable IDs and deterministic ownership.

Advanced .go advanced leaf mergenested leavesdestination leaf winsgocomposite_literal_leavesstructural_signaturenative_read_portable_writenormalize_tracked_layout_merge

Fixture sources

JSON fixture: structuredmerge-fixtures/go/slice-720-advanced-leaf-merge/struct-literal-leaf-merge.json

Compact ruleset: structuredmerge-fixtures/rulesets/go/slice-720-advanced-leaf-merge/struct-literal-leaf-merge.smrules

Fixture view
type PatientSummary struct {
	Profile Profile
}

var Summary = PatientSummary{
	Profile: Profile{
		Name: Name{Given: "Pat", Family: "Template"},
		Contact: Contact{Email: "[email protected]", Phone: "555-0100"},
		CarePlan: CarePlan{Status: "draft", Goals: Goals{Mobility: "walk daily", Nutrition: "low sodium"}},
	},
}
Contract view
{
  "contract_id": "go-struct-literal-leaf-merge",
  "format": "go",
  "owners": "composite_literal_leaves",
  "match": "structural_signature",
  "read": "native_read_portable_write",
  "attach": "normalize_tracked_layout_merge",
  "comment_style": "c_style_line",
  "render": "go_declarations",
  "surfaces": [
    {
      "name": "composite_literal_field",
      "selector": "stable_path"
    }
  ],
  "capabilities": {
    "nested_leaf_merge": true,
    "destination_leaf_wins": true,
    "template_missing_leaf_adds": true
  }
}