From 41ad4dec991c11d9e1efff27fc0b1568f5981c9c Mon Sep 17 00:00:00 2001 From: Russ Cox Date: Mon, 30 Nov 2020 09:34:34 -0500 Subject: [PATCH] [dev.regabi] cmd/compile: fix -h The compile -h flag is *meant* to panic, so you can see the stack trace where the error is being printed. Make it do that again. Change-Id: Ieb0042863582d7a4c5d08d2f866a144962915b06 Reviewed-on: https://go-review.googlesource.com/c/go/+/274116 Trust: Russ Cox Reviewed-by: Matthew Dempsky --- src/cmd/compile/internal/gc/main.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/cmd/compile/internal/gc/main.go b/src/cmd/compile/internal/gc/main.go index 7bad05265d..718239484b 100644 --- a/src/cmd/compile/internal/gc/main.go +++ b/src/cmd/compile/internal/gc/main.go @@ -43,6 +43,9 @@ func hidePanic() { // about a panic too; let the user clean up // the code and try again. if err := recover(); err != nil { + if err == "-h" { + panic(err) + } base.ErrorExit() } }