# go build: build constraints exclude all Go files in /path/to/package

- **ID:** `go/build-target-os`
- **Domain:** go
- **Category:** build_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

All files in the package have build constraints (e.g., //go:build linux) that don't match the target OS/architecture.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| 1.18 | active | — | — |
| 1.19 | active | — | — |

## Workarounds

1. **设置正确的GOOS和GOARCH** (90% success)
   ```
   GOOS=linux GOARCH=amd64 go build
   ```
2. **添加缺失的平台文件** (40% success)
   ```
   创建空文件如empty_other.go并添加构建标签//go:build !linux
   ```

## Dead Ends

- **删除构建标签** — 如果代码依赖于特定平台特性，删除后会导致编译错误。 (70% fail)
- **设置GOOS为任意值** — 需要设置正确的GOOS才能匹配构建标签。 (50% fail)
