ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
## DeepEqual ~~~ func TestReflectDeepEqual(t *testing.T) { // 比较Map m1 := map[int]string{1: "one", 2: "tow", 3: "three"} m2 := map[int]string{1: "one", 2: "tow", 3: "three"} m3 := map[int]string{1: "one", 2: "tow", 4: "four"} t.Log("m1 equal m2:", reflect.DeepEqual(m1, m2)) t.Log("m2 equal m3:", reflect.DeepEqual(m2, m3)) // 比较slice sl1 := []int{1, 3, 5, 7, 9} sl2 := []int{1, 3, 5, 7, 9} sl3 := []int{1, 3, 5, 7, 9, 88} t.Log("sl1 equal sl1:", reflect.DeepEqual(sl1, sl2)) t.Log("sl2 equal sl3:", reflect.DeepEqual(sl2, sl3)) } ~~~