x-motemen / gore

Yet another Go REPL that works nicely. Featured with line editing, code completion, and more.
MIT License
5.11k stars 148 forks source link

Function is called every time when use -context option. #185

Closed rennnosuke closed 4 years ago

rennnosuke commented 4 years ago

Hi,

When .go file is specified with -context option, and once function f() on .go file is called, it is called every time even if it is not inputed f().

ex.

env

OS : Mac OS Catalina 10.16.3 Runtime : Go 1.13.6

context.go

package main

import "fmt"

func start() {
    fmt.Println("exec context.go .")
}
$ gore -context context.go
gore version 0.5.0  :help for help
added file context.go
gore> start()
exec context.go .
gore> fmt.Println("on REPL.")
exec context.go . // called 'start()'  again implicitly. 
on REPL.
9
nil
gore>

Thanks.

itchyny commented 4 years ago

This is an expected behavior due to the fact that gore is not a real read-eval-print loop tool. See https://github.com/motemen/gore#faqcaveats, #67.