# import cycle not allowed: package main imports itself

- **ID:** `go/self-import-cycle`
- **Domain:** go
- **Category:** build_error
- **Verification:** ai_generated
- **Fix Rate:** 90%

## Root Cause

A package directly or indirectly imports itself, creating a dependency cycle that the Go compiler cannot resolve.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| Go 1.18 | active | — | — |
| Go 1.19 | active | — | — |
| Go 1.20 | active | — | — |
| Go 1.21 | active | — | — |
| Go 1.22 | active | — | — |

## Workarounds

1. **Extract shared types or functions into a third package that both original packages import** (95% success)
   ```
   Extract shared types or functions into a third package that both original packages import
   ```
2. **Use interfaces to invert dependencies: define an interface in one package and implement it in another** (90% success)
   ```
   Use interfaces to invert dependencies: define an interface in one package and implement it in another
   ```

## Dead Ends

- **** — Files in the same package cannot import the package; they share the same namespace. (90% fail)
- **** — Blank import still triggers the import mechanism and does not resolve the cycle. (85% fail)
