这样传递参数有什么意义吗?

golwei · 2017-09-20 04:25:11 · 1104 次点击 · 大约8小时之前 开始浏览    置顶
这是一个创建于 2017-09-20 04:25:11 的主题,其中的信息可能已经有所发展或是发生改变。

 func New(value interface{}) *StateMachine {
     return &StateMachine{
         states: map[string]*State{},
        events: map[string]*Event{},
    }
 }

有疑问加站长微信联系(非本文作者)

入群交流(和以上内容无关):加入Go大咖交流群,或添加微信:liuxiaoyan-s 备注:入群;或加QQ群:692541889

1104 次点击  
加入收藏 微博
6 回复  |  直到 2017-09-20 06:59:43
channel
channel · #1 · 8年之前

你是说函数里根本没用上这个传递的参数?

golwei
golwei · #2 · 8年之前
channelchannel #1 回复

你是说函数里根本没用上这个传递的参数?

是的.源码传进去一个结构体.没有使用.是不是有其它访问方式?

polaris
polaris · #3 · 8年之前

你这是哪里看到的代码?没有使用肯定没啥意义啊

golwei
golwei · #4 · 8年之前
polarispolaris #3 回复

你这是哪里看到的代码?没有使用肯定没啥意义啊

qor.transition 的一段源码. https://github.com/qor/transition/transition.go

golwei
golwei · #5 · 8年之前
golweigolwei #4 回复

#3楼 @polaris qor.transition 的一段源码. https://github.com/qor/transition/transition.go

polaris
polaris · #6 · 8年之前

确实没啥用。可能考虑将来有用处吧,没有啥特殊意义!

添加一条新回复 (您需要 登录 后才能回复 没有账号 ?)
  • 请尽量让自己的回复能够对别人有帮助
  • 支持 Markdown 格式, **粗体**、~~删除线~~、`单行代码`
  • 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
  • 图片支持拖拽、截图粘贴等方式上传