# protoc-gen-go: 找不到程序或不可执行

- **ID:** `go/protoc-gen-go-missing-plugin`
- **领域:** go
- **类别:** build_error
- **验证级别:** ai_generated
- **修复率:** 80%

## 根因

protoc 在 PATH 上找不到 protoc-gen-go 插件二进制。它通过 go install 安装，但 $GOPATH/bin 未加入 PATH，或二进制名称不对。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| google.golang.org/protobuf v1.28+ | active | — | — |

## 解决方案

1. **** (95% 成功率)
   ```
   go install google.golang.org/protobuf/cmd/protoc-gen-go@latest
export PATH="$PATH:$(go env GOPATH)/bin"
which protoc-gen-go
   ```
2. **** (90% 成功率)
   ```
   protoc --plugin=protoc-gen-go=$(go env GOPATH)/bin/protoc-gen-go \
  --go_out=. user.proto
   ```

## 无效尝试

- **** — The error is about the Go plugin, not the protoc compiler. Reinstalling protoc does not add protoc-gen-go to PATH. (80% 失败率)
- **** — protoc resolves plugins by name on PATH; passing a binary path as an output directory is invalid. (75% 失败率)
