Exemple #1
0
// NewValue returns a new Value initialized to the concrete value
// stored in the interface i.  NewValue(nil) returns nil.
func NewValue(i interface{}) Value {
	if i == nil {
		return nil
	}
	t, a := unsafe.Reflect(i)
	return newValue(toType(t), addr(a), true)
}
Exemple #2
0
// NewValue returns a new Value initialized to the concrete value
// stored in the interface i.  NewValue(nil) returns nil.
func NewValue(i interface{}) Value {
	if i == nil {
		return nil
	}
	t, a := unsafe.Reflect(i)
	return newValue(canonicalize(toType(t)), addr(a), canSet|canAddr|canStore)
}
Exemple #3
0
func (self *Custom) GoString() string {
	_, addr := unsafe.Reflect(self)
	return fmt.Sprintf("#<%s: %x>", self.name, uintptr(addr))
}