struct 类型转换问题

guosheng1987 · · 792 次点击
name := &post.Uname{Uname: "张三"} or Uname: (*post.Uname)(name)
#1
更多评论
我就是不想用post.Uanme这种方式才自定义的类型,否则就没必要这么做了。如果这个变量在当前文件使用很多次话就必须要每个前面都加post.,是出于这个目的。
#2
2楼 <a href="/user/guosheng1987" title="@guosheng1987">@guosheng1987</a> ```golang type PostUser = post.User type PostUname = post.Uname ``` 使用别名,但是不能拥有对象方法
#3