When writting some Go code that require testing I meet some weird error (but not bug).
Since this error bug me more than once, I figure it would be useful to document this error
packagemainimport("fmt""encoding/json")funcmain(){jsonmsg:=[]byte(`{"item1":"1", "item2":"2"}`)// it is important to note that variable in struct must be capital letter ]// so that Unmarshall able to parse them properlytypemsgstruct{Item1stringItem2string}varmmsg_=json.Unmarshal(jsonmsg,&m)fmt.Println(m)// fail example typemsgsstruct{item1stringitem2string}varm2msgs_=json.Unmarshal(jsonmsg,&m2)fmt.Println(m2)}// output ://{1 2}//{ }