(Screencast taken with cho45/KeyCast)
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.
- 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)
- Pretty printing (pp or spew recommended)
- Showing documents
- Auto-importing (
gore -autoimport
)
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
The gore command requires Go tool-chains on runtime, so standalone binary is not distributed.
GO111MODULE=off go get -u github.com/motemen/gore/cmd/gore
Make sure $GOPATH/bin
is in your $PATH
.
Also recommended:
GO111MODULE=off go get -u github.com/mdempsky/gocode # for code completion
GO111MODULE=off go get -u github.com/k0kubun/pp # or github.com/davecgh/go-spew/spew
- If you see
too many arguments in call to mainScope.LookupParent
while installing gore, rungo get -u golang.org/x/tools/go/types
. - gore runs code using
go run
for each input. If you have entered time-consuming code, gore will run it for each input and take some time. - To import a local package, first fetch it with
go get my/package
, then:import
will work properly.
motemen <motemen@gmail.com>