# package X is not in GOROOT (/usr/local/go/src/X)

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

## 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.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| go1.21 | active | — | — |
| go1.22 | active | — | — |
| go1.23 | active | — | — |

## Workarounds

1. **Initialize a module: `go mod init mymodule` in the project root, then run `go mod tidy`.** (95% success)
   ```
   Initialize a module: `go mod init mymodule` in the project root, then run `go mod tidy`.
   ```
2. **If using GOPATH, ensure the package is under `$GOPATH/src/X` and set `GO111MODULE=off`.** (80% success)
   ```
   If using GOPATH, ensure the package is under `$GOPATH/src/X` and set `GO111MODULE=off`.
   ```

## Dead Ends

- **** — GOROOT must point to the Go installation, not the project; this breaks the toolchain. (98% fail)
- **** — This is not standard practice and will be overwritten on Go updates; also breaks module isolation. (85% fail)
