{
  "id": "go/package-is-not-in-goroot",
  "signature": "package X is not in GOROOT (/usr/local/go/src/X)",
  "signature_zh": "包 X 不在 GOROOT 中 (/usr/local/go/src/X)",
  "regex": "package .+ is not in GOROOT",
  "domain": "go",
  "category": "module_error",
  "subcategory": null,
  "root_cause": "The Go toolchain cannot find a package because it is not installed in the standard library path (GOROOT) and not part of a module; often due to missing go.mod or GOPATH issues.",
  "root_cause_type": "generic",
  "root_cause_zh": "Go 工具链找不到包，因为它不在标准库路径 (GOROOT) 中，也不属于某个模块；通常是由于缺少 go.mod 或 GOPATH 问题。",
  "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": "GOROOT must point to the Go installation, not the project; this breaks the toolchain.",
      "fail_rate": 0.98,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "This is not standard practice and will be overwritten on Go updates; also breaks module isolation.",
      "fail_rate": 0.85,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Initialize a module: `go mod init mymodule` in the project root, then run `go mod tidy`.",
      "success_rate": 0.95,
      "how": "Initialize a module: `go mod init mymodule` in the project root, then run `go mod tidy`.",
      "condition": "",
      "sources": []
    },
    {
      "action": "If using GOPATH, ensure the package is under `$GOPATH/src/X` and set `GO111MODULE=off`.",
      "success_rate": 0.8,
      "how": "If using GOPATH, ensure the package is under `$GOPATH/src/X` and set `GO111MODULE=off`.",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "Initialize a module: `go mod init mymodule` in the project root, then run `go mod tidy`.",
    "If using GOPATH, ensure the package is under `$GOPATH/src/X` and set `GO111MODULE=off`."
  ],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": "https://go.dev/doc/code#GOPATH",
  "official_doc_section": null,
  "error_code": null,
  "verification_tier": "ai_generated",
  "confidence": 0.85,
  "fix_success_rate": 0.9,
  "resolvable": "true",
  "first_seen": "2024-03-01",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}