{
  "id": "go/cannot-use-type-without-star",
  "signature": "cannot use (variable of type T) as type *T in argument",
  "signature_zh": "不能将类型 T 的值用作参数中的类型 *T",
  "regex": "cannot use \\(.*\\) as type \\*.* in argument",
  "domain": "go",
  "category": "type_error",
  "subcategory": null,
  "root_cause": "A function expects a pointer to a type (*T) but receives a non-pointer value (T), causing a type mismatch.",
  "root_cause_type": "generic",
  "root_cause_zh": "函数期望接收指向类型的指针 (*T)，但传入了非指针值 (T)，导致类型不匹配。",
  "versions": [
    {
      "version": "go1.21",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "go1.22",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "go1.23",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "Casting requires the value to be addressable; this often leads to another compilation error.",
      "fail_rate": 0.7,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Modifying library or external function signatures is not always possible or breaks other code.",
      "fail_rate": 0.6,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Pass the address of the variable: `functionName(&variable)` instead of `functionName(variable)`.",
      "success_rate": 0.95,
      "how": "Pass the address of the variable: `functionName(&variable)` instead of `functionName(variable)`.",
      "condition": "",
      "sources": []
    },
    {
      "action": "If the variable is not addressable (e.g., map value), copy it first: `tmp := variable; functionName(&tmp)`.",
      "success_rate": 0.9,
      "how": "If the variable is not addressable (e.g., map value), copy it first: `tmp := variable; functionName(&tmp)`.",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "Pass the address of the variable: `functionName(&variable)` instead of `functionName(variable)`.",
    "If the variable is not addressable (e.g., map value), copy it first: `tmp := variable; functionName(&tmp)`."
  ],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": "https://go.dev/ref/spec#Address_operators",
  "official_doc_section": null,
  "error_code": null,
  "verification_tier": "ai_generated",
  "confidence": 0.88,
  "fix_success_rate": 0.92,
  "resolvable": "true",
  "first_seen": "2023-11-20",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}