duankang8114
2012-09-27 10:43
浏览 30
已采纳

进入交互式shell [重复]

Possible Duplicate:
Does Go provide REPL?

Does anyone know if there is an REPL (interactive go shell, similar to irb) available for go which allows the user to use import statements? I'd like to be able to do something like this:

$igo import ( 
             "log"
             "mypackage/pkg"
            )
log.Print("hello, world!")
pkg.Print("Hello")
...

I've tried igo but that doesn't seem to support this yet.

图片转代码服务由CSDN问答提供 功能建议

可能重复:
去提供REPL吗? < p>是否有人知道是否存在可供用户使用import语句的REPL(交互式go shell,类似于irb)可用? 我希望能够执行以下操作:

  $ igo import(
“ log” 
“ mypackage / pkg” 
)
log.Print  (“你好,世界!”)
pkg.Print(“你好”)
 ... 
   
 
 

我尝试过igo,但这似乎没有 还支持这一点。

  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • dsa89029 2012-09-27 19:42
    已采纳

    There is go-eval from the same author as igo.

    It's an improvement on the old exp/eval package.

    However, I was not able to import packages due to missing symbols, which is probably the reason for igo not supporting the import statement.

    It's probably the best to go with compile/execute software as seen on play.golang.org.

    已采纳该答案
    打赏 评论

相关推荐 更多相似问题