# pattern embed.go: no matching files found

- **ID:** `go/embed-directive-file-not-found`
- **Domain:** go
- **Category:** build_error
- **Verification:** ai_generated
- **Fix Rate:** 92%

## Root Cause

The //go:embed directive specifies a file or pattern that does not exist relative to the source file's directory, or the file is excluded by .gitignore or build constraints.

## Version Compatibility

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

## Workarounds

1. **Verify the file exists relative to the source file; use a glob pattern like "static/*" to embed a directory** (95% success)
   ```
   Verify the file exists relative to the source file; use a glob pattern like "static/*" to embed a directory
   ```
2. **If the file is generated, ensure it is generated before the build (e.g., using go generate)** (85% success)
   ```
   If the file is generated, ensure it is generated before the build (e.g., using go generate)
   ```

## Dead Ends

- **** — Go embed only supports relative paths (to the source file's directory); absolute paths are not allowed. (90% fail)
- **** — Gitignore does not affect Go's embed; the file must exist on disk at build time. (50% fail)
