-
Notifications
You must be signed in to change notification settings - Fork 93
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
Fix 3rd Party Imports Cross-Platform #121
Comments
Hello @switchupcb, For your specific case, I tried executing import (
"fmt"
"github.com/switchupcb/copygen/cli/generator" // third party module; not reflected
"github.com/switchupcb/copygen/cli/models" // extracted module
) inside gomacro running on Linux/arm64 (inside UserLand on my Android mobile) and it produced some errors:
I will have a look if it works better on a PC (i.e. Linux/amd4). About using gomacro inside gomacro: there are at least three different ways to do that.
|
Update: gomacro> import (
"fmt"
"github.com/switchupcb/copygen/cli/generator" // third party module; not reflected
"github.com/switchupcb/copygen/cli/models" // extracted module
)
// debug: running "go get github.com/switchupcb/copygen/cli/generator github.com/switchupcb/copygen/cli/models" ...
go: downloading github.com/switchupcb/copygen v0.3.7
go: downloading golang.org/x/tools v0.1.10
go: downloading github.com/switchupcb/yaegi v0.10.2
go: downloading golang.org/x/mod v0.6.0-dev.0.20220106191415-9b9b3d81d5e3
go: downloading golang.org/x/sys v0.0.0-20220422013727-9388b58f7150
go: downloading golang.org/x/xerrors v0.0.0-20220411194840-2f41105eb62f
go: added github.com/switchupcb/copygen v0.3.7
go: added github.com/switchupcb/yaegi v0.10.2
go: added golang.org/x/mod v0.6.0-dev.0.20220106191415-9b9b3d81d5e3
go: added golang.org/x/sys v0.0.0-20220422013727-9388b58f7150
go: added golang.org/x/tools v0.1.10
go: added golang.org/x/xerrors v0.0.0-20220411194840-2f41105eb62f
// debug: running "go mod tidy" ...
// debug: compiling plugin "/home/max/go/src/gomacro.imports/gomacro_pid_89600/import_1" ...
error loading plugin "/home/max/go/src/gomacro.imports/gomacro_pid_89600/import_1/import_1.so": plugin.Open("/home/max/go/src/gomacro.imports/gomacro_pid_89600/import_1/import_1"): plugin was built with a different version of package golang.org/x/sys/execabs |
What information does an external contributor need to fix this specific issue; such that pre-installed Go modules (by this user; before runtime) can be used by the interpreter at runtime programmatically (without requiring the user to recompile each time)?
We are implementing dynamic template functionality with the use of an interpreter. We are currently using yaegi, which has trouble supporting third party go modules during interpretation without prior reflection. It seems to me that gomacro can use 3rd party libraries programmatically, with a few limitations: recompilation required on platforms with majority-usage share. For more information, read Usage Share of Operating Systems.
Example
Let's say that I want to be able to import an already-installed function in generate.go by using:
When I have already
go get github.com/switchupcb/copygen@...
prior to running this code.Further Inquiry
Is using gomacro possible in gomacro?
The text was updated successfully, but these errors were encountered: