
Golang
Cloud陈
这个作者很懒,什么都没留下…
展开
-
Type Assertion
A type assertion provides access to an interface value's underlying concrete value.t := i.(T)This statement asserts that the interface value i holds the concrete type T and assigns the underlying Tval...原创 2018-04-11 17:27:57 · 293 阅读 · 0 评论 -
Go语言中json.Marshal()一直返回[123 125]的解决方法
Go语言中对结构体进行json.Marshal()一只返回[123 125]即“{}”,原因是go中是否可导出是根据名字首字母是否大写来确定的,如果结构体某字段的首字母为小写则不可导出,例子如下(注意Student内字段首字母的大小写):不可导出:type Student struct { age uint64 name string}func main() { s := &...原创 2018-06-13 16:56:14 · 2410 阅读 · 1 评论