Skip to content

Commit

Permalink
feat: support yaegi in go playground
Browse files Browse the repository at this point in the history
  • Loading branch information
ldez authored and traefiker committed Jul 25, 2019
1 parent 8ace2eb commit aa98e2c
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ before_script:
script:
- make check
- go build -v ./...
- GO111MODULE=off go test -v ./...
- make tests

deploy:
- provider: script
Expand Down
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
14 changes: 1 addition & 13 deletions interp/interp.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{},
Expand All @@ -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
Expand Down

0 comments on commit aa98e2c

Please sign in to comment.