github.com/julianthome/gore@v0.0.0-20231109011145-b3a6bbe6fe55/README.md (about)

     1  # gore [![CI Status](https://github.com/x-motemen/gore/workflows/CI/badge.svg)](https://github.com/x-motemen/gore/actions)
     2  ### Yet another Go REPL that works nicely. Featured with line editing, code completion, and more.
     3  
     4  ![Screencast](doc/screencast.gif)
     5  
     6  (Screencast taken with [cho45/KeyCast](https://github.com/cho45/KeyCast))
     7  
     8  ## Usage
     9  
    10  ```sh
    11  gore
    12  ```
    13  After a prompt is shown, enter any Go expressions/statements/functions or commands described below.
    14  
    15  To quit the session, type `Ctrl-D` or use `:q` command.
    16  
    17  ## Features
    18  
    19  - Line editing with history
    20  - Multi-line input
    21  - Package importing with completion
    22  - Evaluates any expressions, statements and function declarations
    23  - No "evaluated but not used" errors
    24  - Code completion (requires [gocode](https://github.com/mdempsky/gocode))
    25  - Showing documents
    26  - Auto-importing (`gore -autoimport`)
    27  
    28  ## REPL Commands
    29  
    30  Some functionalities are provided as commands in the REPL:
    31  
    32  ```
    33  :import <package path>  Import package
    34  :type <expr>            Print the type of expression
    35  :print                  Show current source
    36  :write [<filename>]     Write out current source to file
    37  :clear                  Clear the codes
    38  :doc <expr or pkg>      Show document
    39  :help                   List commands
    40  :quit                   Quit the session
    41  ```
    42  
    43  ## Installation
    44  The gore command requires Go tool-chains on runtime, so standalone binary is not distributed.
    45  
    46  ```sh
    47  go install github.com/x-motemen/gore/cmd/gore@latest
    48  ```
    49  
    50  Make sure `$GOPATH/bin` is in your `$PATH`.
    51  
    52  Also recommended:
    53  
    54  ```sh
    55  go install github.com/mdempsky/gocode@latest   # for code completion
    56  ```
    57  
    58  Or you can use Docker:
    59  
    60  ```sh
    61  git clone https://github.com/x-motemen/gore.git
    62  cd gore
    63  docker build -t gore .
    64  docker run -it --rm gore
    65  ```
    66  
    67  ## FAQ/Caveats
    68  
    69  - gore runs code using `go run` for each input. All the inputted lines are
    70    evaluated again and again so you can't bind the evaluated time by
    71    `time.Now()`, for example. If you don't like this behavior, you may want to use
    72    [yaegi](https://github.com/containous/yaegi).
    73  - gore support Go modules. You can load local modules when you start gore at
    74    the project directory. You don't need to `go get` to check the usage of a
    75    remote repository, `:import github.com/...` will automatically download that
    76    module. Also, you don't need to `go get` the pretty print module anymore. If
    77    you want to load a local code from `$GOPATH`, you need to create the modules
    78    file (`go mod init ...`) and then start gore at the project directory.
    79  
    80  ## License
    81  
    82  [The MIT License](./LICENSE).
    83  
    84  ## Author
    85  
    86  motemen &lt;<motemen@gmail.com>&gt;