-
Notifications
You must be signed in to change notification settings - Fork 362
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support go module #259
Comments
Hello, yes for now the only way to manage dependencies is to use the |
Can you expand on how to manage dependencies? Let's say I have a local package on my system that I want to import, how do I achieve that? |
Something like that: package main
import (
"go/build"
"github.com/containous/yaegi/interp"
"github.com/containous/yaegi/stdlib"
)
func main() {
// Create an interpreter and setup a GOPATH
i := interp.New(interp.Options{GoPath: build.Default.GOPATH})
// import stdlib
i.Use(stdlib.Symbols)
if _, err := i.Eval(`import "github.com/foo/bar"`); err != nil {
b.Fatal(err)
}
fnHello, err := i.Eval(`bar.Hello`)
if err != nil {
b.Fatal(err)
}
// ...
}
package bar
import github.com/foo/boo
func Hello(){
boo.Hi()
}
package bar
import fmt
func Hello(){
fmt.Println("Hello")
} or you can use the old GOPATH way (no vendor folder) |
any news on this? because right now it is not working. |
Expecte when run
yaegi
in a folder that containsgo.mod
, one can useimport
to import the packages defined in the module ingo.mod
. Currently when I do that, it will reportunable to find source related to: "github.com/Gimi/my-module/pkg"
.The text was updated successfully, but these errors were encountered: