diff --git a/README.md b/README.md index 943f05d..34b10b2 100644 --- a/README.md +++ b/README.md @@ -96,8 +96,7 @@ Many symbol names are also omitted from binary sections at link time. All in all, this can make binaries about 15% smaller. With this flag, no panics or fatal runtime errors will ever be printed, but they -can still be handled internally with `recover` as normal. In addition, the -`GODEBUG` environmental variable will be ignored. +can still be handled internally with `recover` as normal. Note that this flag can make debugging crashes harder, as a panic will simply exit the entire program without printing a stack trace, and source code diff --git a/runtime_patch.go b/runtime_patch.go index 848c0de..4002b18 100644 --- a/runtime_patch.go +++ b/runtime_patch.go @@ -200,27 +200,7 @@ func stripRuntime(basename string, file *ast.File) { funcDecl.Body.List = nil } case "runtime1.go": - usesEnv := func(node ast.Node) bool { - for node := range ast.Preorder(node) { - ident, ok := node.(*ast.Ident) - if ok && ident.Name == "gogetenv" { - return true - } - } - return false - } - filenames: switch funcDecl.Name.Name { - case "parsedebugvars": - // keep defaults for GODEBUG cgocheck and invalidptr, - // remove code that reads GODEBUG via gogetenv - for i, stmt := range funcDecl.Body.List { - if usesEnv(stmt) { - funcDecl.Body.List = funcDecl.Body.List[:i] - break filenames - } - } - panic("did not see any gogetenv call in parsedebugvars") case "setTraceback": // tracebacks are completely hidden, no // sense keeping this function diff --git a/testdata/script/tiny.txtar b/testdata/script/tiny.txtar index c7d99c0..b8f65f4 100644 --- a/testdata/script/tiny.txtar +++ b/testdata/script/tiny.txtar @@ -1,15 +1,12 @@ # Tiny mode exec garble -tiny build ! binsubstr main$exe 'garble_main.go' 'fmt/print.go' -env GODEBUG='allocfreetrace=1,gcpacertrace=1,gctrace=1,inittrace=1,scavenge=1,scavtrace=1,scheddetail=1,schedtrace=10' ! exec ./main$exe -env GODEBUG='' # Ensure further commands don't have weirdness due to GODEBUG. stderr '^\(0x[[:xdigit:]]+,0x[[:xdigit:]]+\)' # interfaces/pointers print correctly # With -tiny, all line numbers are reset to 1. # Unfortunately, line comment directives don't allow erasing line numbers entirely. stderr '^caller: \?\? 1$' # position info is removed stderr '^recovered: ya like jazz?' -! stderr '^init runtime' # GODEBUG prints are hidden, like inittrace=1 ! stderr 'panic: oh noes' # panics are hidden stderr 'funcExported false funcUnexported true' stderr 'funcStructExported false funcStructUnexported true'