英文: Decode XML into interface type with Go? 问题 在Go 1.3中,将XML解码为接口类型是可能的吗? 例如,如果结构体看起来像这样(简化): type F...
覆盖嵌入结构的行为
英文: Overwriting behavior of embedded struct 问题 我有一个类型为XY的结构体,它有各种字段和方法(几十个)。 type XY struct { Name s...
Create method for map[string]interface{} in Go
英文: Create method for map[string]interface{} in Go 问题 我已经定义了一个类型: type UnknownMapString map[string]i...
在Golang中返回接口
英文: Returning interfaces in Golang 问题 我正在尝试在一个结构体上编写一个方法,该方法接受一个接口类型,并将该接口类型转换为相应的类型后返回。 type Model ...
改进扩展实现者之间的反射
英文: Improve reflection between extended implementors 问题 我有一个Result接口,表示结果的最小状态。现在有不同的结构体实现了Result接口,...
在结构体(struct)或接口(interface)内部执行计算?
英文: perform computation inside struct or interface? 问题 我正在构建一个要保存到MongoDB的数据。我从一个API得到了一个JSON响应,格式如下...
如何解决”type interface has no field or method”错误?
英文: How to work around "type interface has no field or method" error? 问题 我想要为mgo API编写一个抽象...
将结构指针转换为interface{}。
英文: convert struct pointer to interface{} 问题 如果我有: type foo struct{ } func bar(baz interface{}) { } ...
在Google Go中,抽象类和抽象方法的等效概念是什么?
英文: Equivalence of abstract classes/methods (Java) in Google Go 问题 我是新手,想知道如何在Go语言中实现类似于Java中的抽象类和抽象...
当将对象传递并在interface{}中捕获时,无法访问函数。
英文: Can't access function when passing object and catching it in a interface{} 问题 这是我尝试做的事情: pac...
56