{
  "id": "go/cannot-embed-function-type",
  "signature": "cannot embed function type T",
  "signature_zh": "无法嵌入函数类型T",
  "regex": "cannot embed function type [A-Za-z0-9_]+",
  "domain": "go",
  "category": "type_error",
  "subcategory": null,
  "root_cause": "Go does not allow embedding function types directly in structs; only interface types can be embedded.",
  "root_cause_type": "generic",
  "root_cause_zh": "Go不允许在结构体中直接嵌入函数类型；只有接口类型可以被嵌入。",
  "versions": [
    {
      "version": "Go 1.18",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "Go 1.19",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "Go 1.20",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "Embedding requires a type name, not a value; a function field is a different semantic (has-a vs is-a).",
      "fail_rate": 0.7,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Aliases do not change the fundamental type category; embedding still fails.",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Define an interface type with the same method signature and embed that interface instead",
      "success_rate": 0.95,
      "how": "Define an interface type with the same method signature and embed that interface instead",
      "condition": "",
      "sources": []
    },
    {
      "action": "Use a named struct field with the function type",
      "success_rate": 0.9,
      "how": "Use a named struct field with the function type",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "Define an interface type with the same method signature and embed that interface instead",
    "Use a named struct field with the function type"
  ],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": "https://go.dev/ref/spec#Struct_types",
  "official_doc_section": null,
  "error_code": null,
  "verification_tier": "ai_generated",
  "confidence": 0.88,
  "fix_success_rate": 0.92,
  "resolvable": "true",
  "first_seen": "2024-01-10",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}