我正在尝试将接口的内部值设置nil为如下所示:
nil
typ := &TYP{InternalState: "filled"} setNil(typ) fmt.Printf("Expecting that %v to be nil", typ)
我需要知道如何实现该setNil(typ interface{})方法.
setNil(typ interface{})
有关更多详细信息,请参阅play.golang.org中的此代码.
reflection pointers interface go
go ×1
interface ×1
pointers ×1
reflection ×1