Go出现警告struct doesn't have any exported fields, nor custom marshaling
Go语言要求所有结构体成员变量的首字母需要大写,如果首字母小写的话,则该字段无法被外部包访问和解析,比如,json解析。
type student struct {
Id int
Name string
}
所以修改成员变量首字母为大写即可
Go语言要求所有结构体成员变量的首字母需要大写,如果首字母小写的话,则该字段无法被外部包访问和解析,比如,json解析。
type student struct {
Id int
Name string
}
所以修改成员变量首字母为大写即可