# 包 net/http 不在 GOROOT 中

- **ID:** `go/package-not-in-goroot`
- **领域:** go
- **类别:** build_error
- **验证级别:** ai_generated
- **修复率:** 80%

## 根因

Go 标准库包从 GOROOT 目录中丢失，可能是由于安装损坏或错误的 GOROOT。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| 1.20 | active | — | — |
| 1.21 | active | — | — |
| 1.22 | active | — | — |

## 解决方案

1. **Reinstall Go completely to restore missing standard library files.** (95% 成功率)
   ```
   Download the official Go distribution from golang.org and reinstall.
   ```
2. **Check and set GOROOT correctly if using multiple Go versions.** (85% 成功率)
   ```
   Run 'go env GOROOT' to see current value, then set 'export GOROOT=/usr/local/go' (or correct path) if misconfigured.
   ```

## 无效尝试

- **Setting GOROOT to a different Go installation.** — If the new GOROOT also lacks the package, the error persists. (60% 失败率)
- **Reinstalling only the missing package manually.** — Go standard library is monolithic; individual packages cannot be reinstalled separately. (100% 失败率)
