temporary tests
This commit is contained in:
parent
e2557da13f
commit
c879b68f06
3 changed files with 58 additions and 16 deletions
|
@ -6,11 +6,20 @@ import (
|
||||||
"github.com/eh-steve/goloader/jit"
|
"github.com/eh-steve/goloader/jit"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// plugins/addsymbol
|
||||||
|
type AddSymbol interface {
|
||||||
|
st() map[string]interface{}
|
||||||
|
}
|
||||||
|
|
||||||
|
type STR struct {
|
||||||
|
ress func(a string, b string) (interface{}, error)
|
||||||
|
}
|
||||||
|
|
||||||
func PluginManager(params ...string) {
|
func PluginManager(params ...string) {
|
||||||
conf := jit.BuildConfig{
|
conf := jit.BuildConfig{
|
||||||
KeepTempFiles: false, // Files are copied/written to a temp dir to ensure it is writable. This retains the temporary copies
|
KeepTempFiles: false, // Files are copied/written to a temp dir to ensure it is writable. This retains the temporary copies
|
||||||
ExtraBuildFlags: []string{"-x"}, // Flags passed to go build command
|
ExtraBuildFlags: []string{"-x"}, // Flags passed to go build command
|
||||||
BuildEnv: []string{"GOOS=darwin"}, // Env vars to set for go build toolchain
|
BuildEnv: []string{"GOOS=linux"}, // Env vars to set for go build toolchain
|
||||||
TmpDir: "/tmp/inner", // To control where temporary files are copied
|
TmpDir: "/tmp/inner", // To control where temporary files are copied
|
||||||
DebugLog: false, //
|
DebugLog: false, //
|
||||||
}
|
}
|
||||||
|
@ -38,10 +47,10 @@ func PluginManager(params ...string) {
|
||||||
panic("Function signature was not what was expected")
|
panic("Function signature was not what was expected")
|
||||||
}
|
}
|
||||||
|
|
||||||
err = module.Unload()
|
// err = module.Unload()
|
||||||
if err != nil {
|
// if err != nil {
|
||||||
panic(err)
|
// panic(err)
|
||||||
}
|
// }
|
||||||
|
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
|
@ -60,21 +69,50 @@ func PluginManager(params ...string) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
switch f := symbols2["Symbol"].(type) {
|
// rst
|
||||||
|
switch Symbol := symbols2["Symbol"].(type) {
|
||||||
|
// rstrst
|
||||||
case func(a, b string) (interface{}, error):
|
case func(a, b string) (interface{}, error):
|
||||||
result, err := f("a", "b")
|
// var mystruct SymbolPlugS
|
||||||
if err != nil {
|
|
||||||
panic(err)
|
var mystr STR
|
||||||
}
|
mystr.ress = Symbol
|
||||||
fmt.Println(result)
|
|
||||||
|
// result, err := Im("a", "b")
|
||||||
|
// if err != nil {
|
||||||
|
// panic(err)
|
||||||
|
// }
|
||||||
|
fmt.Println(mystr.ress("a", "b"))
|
||||||
|
fmt.Println(&mystr.ress)
|
||||||
|
// fmt.Println(*mystr.ress)
|
||||||
|
// fmt.Println(*tmpresult)
|
||||||
|
// fmt.Println()
|
||||||
default:
|
default:
|
||||||
fmt.Println(f)
|
fmt.Println(symbols2)
|
||||||
|
|
||||||
panic("Function signature was not what was expected")
|
panic("Function signature was not what was expected")
|
||||||
}
|
}
|
||||||
|
// Symbol := symbols2["Symbol"]
|
||||||
|
// if f, ok := Symbol.(func(a, b string) (interface{}, error)); ok {
|
||||||
|
// // fmt.Println(HandlerType(f)("rst", "rstrtd"))
|
||||||
|
// fmt.Println(f("ast", "srd"))
|
||||||
|
// }
|
||||||
|
|
||||||
|
// for i, v := range symbols2 {
|
||||||
|
// fmt.Println(i, v)
|
||||||
|
// }
|
||||||
|
fmt.Println(&symbols2)
|
||||||
|
fmt.Println(symbols2)
|
||||||
|
fmt.Println()
|
||||||
|
fmt.Println(symbols)
|
||||||
|
fmt.Println(&symbols)
|
||||||
err = module2.Unload()
|
err = module2.Unload()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func printsymbol() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
BIN
go-loader-test
BIN
go-loader-test
Binary file not shown.
|
@ -3,3 +3,7 @@ package addsymbol
|
||||||
func Symbol(a, b string) (interface{}, error) {
|
func Symbol(a, b string) (interface{}, error) {
|
||||||
return symbol(a, b), nil
|
return symbol(a, b), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TMPFUNC() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue