github.com/cnboonhan/delve@v0.0.0-20230908061759-363f2388c2fb/_fixtures/plugintest.go (about) 1 package main 2 3 import ( 4 "fmt" 5 "os" 6 "plugin" 7 "runtime" 8 ) 9 10 func must(err error) { 11 if err != nil { 12 panic(err) 13 } 14 } 15 16 func main() { 17 plug1, err := plugin.Open(os.Args[1]) 18 must(err) 19 20 runtime.Breakpoint() 21 22 plug2, err := plugin.Open(os.Args[2]) 23 must(err) 24 25 runtime.Breakpoint() 26 27 fn1, err := plug1.Lookup("Fn1") 28 must(err) 29 fn2, err := plug2.Lookup("Fn2") 30 must(err) 31 32 a := fn1.(func() string)() 33 b := fn2.(func() string)() 34 35 fmt.Println(plug1, plug2, fn1, fn2, a, b) 36 }