From aa98e2c2a9d21ce621f24410bcc79927ce331219 Mon Sep 17 00:00:00 2001 From: Ludovic Fernandez Date: Wed, 24 Jul 2019 17:52:03 -0700 Subject: [PATCH] feat: support yaegi in go playground --- .travis.yml | 2 +- Makefile | 3 +++ interp/interp.go | 14 +------------- 3 files changed, 5 insertions(+), 14 deletions(-) diff --git a/.travis.yml b/.travis.yml index f478c545..f57710e8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -36,7 +36,7 @@ before_script: script: - make check - go build -v ./... - - GO111MODULE=off go test -v ./... + - make tests deploy: - provider: script diff --git a/Makefile b/Makefile index 9f98301b..1e8509c6 100644 --- a/Makefile +++ b/Makefile @@ -16,4 +16,7 @@ cmd/goexports/goexports: cmd/goexports/goexports.go generate: gen_all_syscall go generate +tests: + GO111MODULE=off go test -v ./... + .PHONY: check gen_all_syscall gen_tests diff --git a/interp/interp.go b/interp/interp.go index 37df30c9..efb5b1e0 100644 --- a/interp/interp.go +++ b/interp/interp.go @@ -123,7 +123,7 @@ type Options struct { // New returns a new interpreter func New(options Options) *Interpreter { i := Interpreter{ - opt: opt{goPath: getGoPath(options)}, + opt: opt{goPath: options.GoPath}, fset: token.NewFileSet(), universe: initUniverse(), scopes: map[string]*scope{}, @@ -143,18 +143,6 @@ func New(options Options) *Interpreter { return &i } -func getGoPath(options Options) string { - if options.GoPath != "" { - return options.GoPath - } - - goPath, err := os.Executable() - if err != nil { - panic(err) - } - return goPath -} - func initUniverse() *scope { sc := &scope{global: true, sym: map[string]*symbol{ // predefined Go types