# package example.com/foo is not in GOROOT (/usr/local/go/src/example.com/foo)

- **ID:** `go/package-not-found-in-goroot`
- **Domain:** go
- **Category:** module_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

Import path is incorrectly resolved to GOROOT's standard library instead of a module dependency.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| 1.16 | active | — | — |
| 1.17 | active | — | — |

## Workarounds

1. **确保在模块目录内运行** (80% success)
   ```
   cd /path/to/module && go build
   ```
2. **设置GO111MODULE=on** (90% success)
   ```
   export GO111MODULE=on
go build
   ```

## Dead Ends

- **复制包到GOROOT目录** — GOROOT不应被修改，且这不是正确做法。 (90% fail)
- **设置GO111MODULE=off** — 禁用模块模式会导致其他依赖问题。 (70% fail)
