草庐IT

expectedStruct

全部标签

json - 去测试 map 之间的区别

我正在尝试对json对象运行一些测试。目前我有一个函数来比较json字符串并在它们不匹配时输出错误消息:funcassertJsonEqual(expected,actualstring)bool{actualStruct:=make(map[string]interface{})expectedStruct:=make(map[string]interface{})json.Unmarshal([]byte(expected),&expectedStruct)json.Unmarshal([]byte(actual),&actualStruct)if!reflect.DeepEqua