From eafe9a186c84dcfb7db1038cc43d1f0dfd1ea781 Mon Sep 17 00:00:00 2001 From: Keith Randall Date: Fri, 25 Jan 2019 10:21:40 -0800 Subject: cmd/compile: hide init functions in tracebacks Treat compiler-generated init functions as wrappers, so they will not be shown in tracebacks. The exception to this rule is that we'd like to show the line number of initializers for global variables in tracebacks. In order to preserve line numbers for those cases, separate out the code for those initializers into a separate function (which is not marked as autogenerated). This CL makes the go binary 0.2% bigger. Fixes #29919 Change-Id: I0f1fbfc03d10d764ce3a8ddb48fb387ca8453386 Reviewed-on: https://go-review.googlesource.com/c/159717 Run-TryBot: Keith Randall TryBot-Result: Gobot Gobot Reviewed-by: Ian Lance Taylor --- src/cmd/internal/objabi/funcid.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/cmd/internal') diff --git a/src/cmd/internal/objabi/funcid.go b/src/cmd/internal/objabi/funcid.go index 1792df7cc1..a30bc3fa05 100644 --- a/src/cmd/internal/objabi/funcid.go +++ b/src/cmd/internal/objabi/funcid.go @@ -83,7 +83,7 @@ func GetFuncID(name, file string) FuncID { case "runtime.panicwrap": return FuncID_panicwrap } - if file == "" && !strings.HasSuffix(name, ".init") { + if file == "" { return FuncID_wrapper } if strings.HasPrefix(name, "runtime.call") { -- cgit v1.3