feat: support yaegi in go playground

This commit is contained in:
Ludovic Fernandez
2019-07-24 17:52:03 -07:00
committed by Traefiker Bot
parent 8ace2eb6e6
commit aa98e2c2a9
3 changed files with 5 additions and 14 deletions

View File

@@ -36,7 +36,7 @@ before_script:
script: script:
- make check - make check
- go build -v ./... - go build -v ./...
- GO111MODULE=off go test -v ./... - make tests
deploy: deploy:
- provider: script - provider: script

View File

@@ -16,4 +16,7 @@ cmd/goexports/goexports: cmd/goexports/goexports.go
generate: gen_all_syscall generate: gen_all_syscall
go generate go generate
tests:
GO111MODULE=off go test -v ./...
.PHONY: check gen_all_syscall gen_tests .PHONY: check gen_all_syscall gen_tests

View File

@@ -123,7 +123,7 @@ type Options struct {
// New returns a new interpreter // New returns a new interpreter
func New(options Options) *Interpreter { func New(options Options) *Interpreter {
i := Interpreter{ i := Interpreter{
opt: opt{goPath: getGoPath(options)}, opt: opt{goPath: options.GoPath},
fset: token.NewFileSet(), fset: token.NewFileSet(),
universe: initUniverse(), universe: initUniverse(),
scopes: map[string]*scope{}, scopes: map[string]*scope{},
@@ -143,18 +143,6 @@ func New(options Options) *Interpreter {
return &i 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 { func initUniverse() *scope {
sc := &scope{global: true, sym: map[string]*symbol{ sc := &scope{global: true, sym: map[string]*symbol{
// predefined Go types // predefined Go types