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))