From bca460e36e7c39978cf3614f517f1101bcacd2a8 Mon Sep 17 00:00:00 2001 From: Andrew LeFevre Date: Sat, 31 Oct 2020 19:38:51 -0400 Subject: [PATCH] Print interfaces/pointers when -tiny is used (#170) fixes #167 --- runtime_strip.go | 1 + testdata/scripts/tiny.txt | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/runtime_strip.go b/runtime_strip.go index fff7c62..c87944b 100644 --- a/runtime_strip.go +++ b/runtime_strip.go @@ -121,6 +121,7 @@ func stripRuntime(filename string, file *ast.File) { if filename == "print.go" { file.Decls = append(file.Decls, hidePrintDecl) + return } // replace all 'print' and 'println' statements in diff --git a/testdata/scripts/tiny.txt b/testdata/scripts/tiny.txt index e34a02d..c1df88b 100644 --- a/testdata/scripts/tiny.txt +++ b/testdata/scripts/tiny.txt @@ -5,6 +5,7 @@ garble -tiny build ! binsubstr main$exe 'main.go' 'fmt/print.go' env GODEBUG='allocfreetrace=1,gcpacertrace=1,gctrace=1,scavenge=1,scavtrace=1,scheddetail=1,schedtrace=10' ! exec ./main$exe +stderr '^\(0x[\d\w]{6,8},0x[\d\w]{6,8}\)' # interfaces/pointers print correctly stderr '^caller: \? 0$' # position info is removed stderr '^recovered: ya like jazz?' ! stderr 'panic: oh noes' # panics are hidden @@ -27,6 +28,9 @@ package main import "runtime" func main() { + var v interface{} = "tada" + println(v) + defer func() { if r := recover(); r != nil { println("recovered:", r.(string))