Merge pull request #211 from baileywickham/master

Added warning for capital field names in structs
This commit is contained in:
Mark McGranaghan 2019-09-01 16:17:42 -07:00 committed by GitHub
commit 738d92e305
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -14,6 +14,8 @@ type response1 struct {
Page int Page int
Fruits []string Fruits []string
} }
// Only exported fields will be encoded/decoded in JSON.
// Fields must start with capital letters to be exported.
type response2 struct { type response2 struct {
Page int `json:"page"` Page int `json:"page"`
Fruits []string `json:"fruits"` Fruits []string `json:"fruits"`