Description
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:
import (
"fmt"
"github.com/switchupcb/copygen/cli/generator" // third party module; not reflected
"github.com/switchupcb/copygen/cli/models" // extracted module
)
func Generate(gen *models.Generator) (string, error) {
content := string(gen.Keep) + "\n"
fmt.Println(generator.GenerateFunction) // custom type in third party module (a string alias) // or any other object
...
}
When I have already go get github.com/switchupcb/copygen@...
prior to running this code.
Further Inquiry
Is using gomacro possible in gomacro?
Activity