如何比较地图的身份或此示例中发生了什么?

I'm trying to compare the identity of 2 maps

package main

import "fmt"

func main() {
    a := map[int]map[int]int{1:{2:2}}

    b := a[1]
    c := a[1]

    // I can't do this: 
    // if b == c
    // because I get: 
    // invalid operation: b == c (map can only be compared to nil)

    // but as far as I can tell, mutation works, meaning that the 2 maps might actually be identical
    b[3] = 3

    fmt.Println(c[3]) // so mutation works...


    fmt.Printf("b as pointer::%p
", b)
    fmt.Printf("c as pointer::%p
", c) 

    // ok, so maybe these are the pointers to the variables b and c... but still, those variables contain the references to the same map, so it's understandable that these are different, but then I can't compare b==c like this
    fmt.Printf("&b::%p
", &b)
    fmt.Printf("&c::%p
", &c)  

    fmt.Println(&b == &c)
}

this produces the following output:

3
b as pointer::0x442280
c as pointer::0x442280
&b::0x40e130
&c::0x40e138
false

What's especially confusing to me is that while b as pointer::0x442280 and c as pointer::0x442280 seem to have the same values, which indeed would confirm to me my suspicion that those variables somehow point to the same dict.

So does anyone know how I can make go tell be that b and c are "the same object"?

Ok, so I'm obviously new to the language, and I won't start criticizing it so soon, but this is the solution I found:

Python code:

obj1 is obj2

Javascript code:

obj1 === obj2  // for objects, which is what I care about

Java code:

obj1 == obj2

And then there's go code:

fmt.Sprintf("%p", obj1) == fmt.Sprintf("%p", obj2)

Yes, it's exactly what it looks like: I get the string representation of pointers to the 2 variables, and compare those. And the strings look like this 0x442280.

fmt.DeepEqual is not the solution for me, because

  1. it checks whether the pointers are equal and then
  2. it then checks whether the values in the map are equal

This is completely not what I want. I want to know only if the maps are exactly the same object, not wether they contain the same values

Not pretty but you can use reflect.ValueOf(b).Pointer():

package main

import (
    "fmt"
    "reflect"
)

func main() {
    a := map[int]map[int]int{1: {2: 2}}

    b := a[1]
    c := a[1]

    d := map[int]int{2: 2}

    fmt.Println(reflect.ValueOf(b).Pointer() == reflect.ValueOf(c).Pointer())
    fmt.Println(reflect.ValueOf(c).Pointer() == reflect.ValueOf(d).Pointer())
}