Go出现警告struct doesn‘t have any exported fields, nor custom marshaling
生活随笔
收集整理的這篇文章主要介紹了
Go出现警告struct doesn‘t have any exported fields, nor custom marshaling
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
Go出現警告struct doesn't have any exported fields, nor custom marshaling
Go語言要求所有結構體成員變量的首字母需要大寫,如果首字母小寫的話,則該字段無法被外部包訪問和解析,比如,json解析。
type student struct {Id intName string }所以修改成員變量首字母為大寫即可
總結
以上是生活随笔為你收集整理的Go出现警告struct doesn‘t have any exported fields, nor custom marshaling的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 字符串格式化
- 下一篇: 关于 block的一些浅识