• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

x-motemen/gore: Yet another Go REPL that works nicely. Featured with line editin ...

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称:

x-motemen/gore

开源软件地址:

https://github.com/x-motemen/gore

开源编程语言:

Go 98.1%

开源软件介绍:

gore CI Status

Yet another Go REPL that works nicely. Featured with line editing, code completion, and more.

Screencast

(Screencast taken with cho45/KeyCast)

Usage

gore

After a prompt is shown, enter any Go expressions/statements/functions or commands described below.

To quit the session, type Ctrl-D or use :q command.

Features

  • Line editing with history
  • Multi-line input
  • Package importing with completion
  • Evaluates any expressions, statements and function declarations
  • No "evaluated but not used" errors
  • Code completion (requires gocode)
  • Showing documents
  • Auto-importing (gore -autoimport)

REPL Commands

Some functionalities are provided as commands in the REPL:

:import <package path>  Import package
:type <expr>            Print the type of expression
:print                  Show current source
:write [<filename>]     Write out current source to file
:clear                  Clear the codes
:doc <expr or pkg>      Show document
:help                   List commands
:quit                   Quit the session

Installation

The gore command requires Go tool-chains on runtime, so standalone binary is not distributed.

go install github.com/x-motemen/gore/cmd/gore@latest

Make sure $GOPATH/bin is in your $PATH.

Also recommended:

go install github.com/mdempsky/gocode@latest   # for code completion

Or you can use Docker:

git clone https://github.com/x-motemen/gore.git
cd gore
docker build -t gore .
docker run -it --rm gore

FAQ/Caveats

  • gore runs code using go run for each input. All the inputted lines are evaluated again and again so you can't bind the evaluated time by time.Now(), for example. If you don't like this behavior, you may want to use yaegi.
  • gore support Go modules. You can load local modules when you start gore at the project directory. You don't need to go get to check the usage of a remote repository, :import github.com/... will automatically download that module. Also, you don't need to go get the pretty print module anymore. If you want to load a local code from $GOPATH, you need to create the modules file (go mod init ...) and then start gore at the project directory.

License

The MIT License.

Author

motemen <[email protected]>




鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
GoesToEleven/go-programming发布时间:2022-06-13
下一篇:
GoodManWEN/GoodManWEN.github.io: 发布时间:2022-06-13
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap