From 84afa1be76f89a602c1aef73603175e644f1dc2f Mon Sep 17 00:00:00 2001 From: Matthew Dempsky Date: Wed, 21 Oct 2015 12:12:25 -0700 Subject: runtime: make iface/eface handling more type safe Change compiler-invoked interface functions to directly take iface/eface parameters instead of fInterface/interface{} to avoid needing to always convert. For the handful of functions that legitimately need to take an interface{} parameter, add efaceOf to type-safely convert *interface{} to *eface. Change-Id: I8928761a12fd3c771394f36adf93d3006a9fcf39 Reviewed-on: https://go-review.googlesource.com/16166 Run-TryBot: Matthew Dempsky TryBot-Result: Gobot Gobot Reviewed-by: Ian Lance Taylor --- src/runtime/error.go | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'src/runtime/error.go') diff --git a/src/runtime/error.go b/src/runtime/error.go index 4280306ac5..de07bcb643 100644 --- a/src/runtime/error.go +++ b/src/runtime/error.go @@ -4,8 +4,6 @@ package runtime -import "unsafe" - // The Error interface identifies a run time error. type Error interface { error @@ -57,7 +55,7 @@ type stringer interface { } func typestring(x interface{}) string { - e := (*eface)(unsafe.Pointer(&x)) + e := efaceOf(&x) return *e._type._string } -- cgit v1.3