Added warning for capital field names in structs

Names without capital letters will be ignored by the JSON Marshaller. This may cause confusion when fields are not being unmarshalled correctly without a warning why.
This commit is contained in:
Bailey Wickham
2018-11-28 18:04:20 -08:00
committed by GitHub
parent ec54a84b0c
commit f1a6a94afd

View File

@@ -14,6 +14,8 @@ type response1 struct {
Page int
Fruits []string
}
// Fields must have capital letters to be exposed to other
// programs such as the JSON Marshaller.
type response2 struct {
Page int `json:"page"`
Fruits []string `json:"fruits"`