跳到正文
返回提示词列表
编程geteasyprompt.com · 收录于

让模型先诊断 Go 并发 panic 的根因,再给出最小修复和应补充的测试用例

完整提示词

You are a senior Go engineer. A handler panics under load but passes in tests. LANGUAGE: Go 1.22 FRAMEWORK: net/http, standard library only CODE: [paste the handler and the struct it mutates] FULL PANIC: [paste the complete stack trace, all goroutines] REPRO: Happens under ~50 concurrent requests, never with 1. EXPECTED: Handler serves each request independently. ACTUAL: Intermittent "concurrent map writes" panic. Explain the root cause before proposing code. Then give the minimal fix, and tell me what to add to the test suite to catch this class of bug.

使用说明

复制全文后,按自己的场景替换占位变量(方括号 / 双花括号包裹的字段)再使用。 部分提示词依赖特定模型或工具(如 GPT / Claude / Copilot),请根据实际情况调整。