英文:
Go interactive shell
问题
有人知道是否有一个 REPL(交互式的 Go shell,类似于 irb)可用于 Go,允许用户使用 import 语句吗?我想能够像这样做:
$igo import (
"log"
"mypackage/pkg"
)
log.Print("hello, world!")
pkg.Print("Hello")
...
我尝试过 igo,但似乎还不支持这个功能。
英文:
> Possible Duplicate:
> Does Go provide REPL?
<!-- End of automatically inserted text -->
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.
答案1
得分: 10
有go-eval
这个库是由与igo
相同的作者开发的。
它是对旧的exp/eval
包的改进。
然而,由于缺少符号,我无法导入包,这可能是igo
不支持import
语句的原因。
最好选择像play.golang.org上看到的编译/执行软件。
英文:
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.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论