struct 类型转换问题

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