```
package main
import (
"fmt"
)
var person map[string]struct {name string}
func main() {
type nameStruct struct {name string}
var person2 map[string]nameStruct
person2 = person
fmt.Println(person2)
}
```
这样编译的时候 person2 = person这一句出错:
cannot use person (type map[string]struct { name string }) as type map[string]name in assignment
但是 **struct { name string }** 和 ** nameStruct ** 不是一样的吗?
更多评论
```go
package main
import (
"fmt"
)
type nameStruct struct {name string}
var person map[string] nameStruct
func main() {
var person2 map[string]nameStruct
person2 = person
fmt.Println(person2)
}
```
建议这么玩
#3