next.js
f87a266e - Show source frames for Go route compiler errors (#102720)

Commit
1 hour ago
Show source frames for Go route compiler errors (#102720) ### What? Show Go Route Handler compiler errors with the original file, line, and column and a code frame in the dev overlay and in `next build`. Add coverage for fixing a syntax error in dev and for reporting type errors in two routes during a build. <img width="2160" height="1280" alt="download" src="https://github.com/user-attachments/assets/5b06b271-e240-4b73-b843-01534647b7a1" /> ### Why? Compiler output could point into a temporary Go overlay directory. In production, the same output could also be repeated for unrelated routes. ### How? Map temporary Go compiler paths back to their source files and emit a Turbopack issue for each diagnostic with a usable source location. Keep the compiler text for diagnostics without a source location. ### Verification - `cargo test -p turbopack-go --locked --lib` - Verified the existing recovery after a first Go compilation failure and the invalid handler signature diagnostic with the focused Turbopack dev and build suites. - Confirmed in Chromium that the dev overlay shows a Go error with a code frame, and ran `next build --turbopack` on a broken Go route to confirm the terminal output. <!-- NEXT_JS_LLM -->
Author
Parents
Loading