鉴于该方法具有指针接收器,因此存储新值是规范的。例如:
type MyTime time.Time
func (mt *MyTime) Change(other time.Time) {
*mt = MyTime(other)
}
但是没有指针接收器有可能吗?
type MyTime time.Time
func (mt MyTime) Change(other time.Time) {
// ???
}
也许使用reflect或atomic包装?
Qyouu
森林海
随时随地看视频慕课网APP
相关分类