]> Cypherpunks repositories - gostls13.git/commitdiff
[dev.regabi] cmd/compile: fix -h
authorRuss Cox <rsc@golang.org>
Mon, 30 Nov 2020 14:34:34 +0000 (09:34 -0500)
committerRuss Cox <rsc@golang.org>
Mon, 30 Nov 2020 23:48:42 +0000 (23:48 +0000)
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 <rsc@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
src/cmd/compile/internal/gc/main.go

index 7bad05265d67a93be41add6c449cbd4560b8fbbd..718239484b7c37f19514e7e1c22bb7025d0c1743 100644 (file)
@@ -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()
                }
        }