```
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 ** 不是一样的吗?
有疑问加站长微信联系(非本文作者)