{
  "id": "go/cannot-find-package-in-gopath",
  "signature": "package example.com/user/project: cannot find package \"example.com/user/project\" in any of:\n\t/usr/local/go/src/example.com/user/project (from $GOROOT)\n\t/home/user/go/src/example.com/user/project (from $GOPATH)",
  "signature_zh": "包 example.com/user/project：在任何位置都找不到包 \"example.com/user/project\"：\n\t/usr/local/go/src/example.com/user/project（来自 $GOROOT）\n\t/home/user/go/src/example.com/user/project（来自 $GOPATH）",
  "regex": "package\\ example\\.com/user/project:\\ cannot\\ find\\ package\\ \"example\\.com/user/project\"\\ in\\ any\\ of:\\\n\\\t/usr/local/go/src/example\\.com/user/project\\ \\(from\\ \\$GOROOT\\)\\\n\\\t/home/user/go/src/example\\.com/user/project\\ \\(from\\ \\$GOPATH\\)",
  "domain": "go",
  "category": "build_error",
  "subcategory": null,
  "root_cause": "The package is not located in the expected GOPATH or GOROOT directories, often because the project was not cloned into the correct GOPATH structure or modules are not enabled.",
  "root_cause_type": "generic",
  "root_cause_zh": "包未位于预期的 GOPATH 或 GOROOT 目录中，通常是因为项目未克隆到正确的 GOPATH 结构中，或者未启用模块。",
  "versions": [
    {
      "version": "1.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "1.1",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "1.2",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "1.3",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "1.4",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "1.5",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "1.6",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "1.7",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "1.8",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "1.9",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "1.10",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "1.11",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "1.12",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "1.13",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "1.14",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "1.15",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "1.16",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "Setting GO111MODULE=off and hoping GOPATH resolves",
      "why_fails": "Disabling modules forces GOPATH mode, but if the project is not in the correct GOPATH src directory, it still fails.",
      "fail_rate": 0.7,
      "condition": "",
      "sources": []
    },
    {
      "action": "Copying the project to GOROOT/src",
      "why_fails": "GOROOT is for the standard library; placing user projects there is unsupported and can cause conflicts.",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Enable Go modules and initialize the module",
      "success_rate": 0.95,
      "how": "GO111MODULE=on go mod init example.com/user/project",
      "condition": "",
      "sources": []
    },
    {
      "action": "Move the project to the correct GOPATH location",
      "success_rate": 0.85,
      "how": "mkdir -p $GOPATH/src/example.com/user && mv /current/project $GOPATH/src/example.com/user/project",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": null,
  "official_doc_section": null,
  "error_code": null,
  "verification_tier": "ai_generated",
  "confidence": 0.87,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2024-05-20",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}