From 5302ce57db88ae6eb6048ceebace8743119d0d0f Mon Sep 17 00:00:00 2001 From: Sithembiso Khumalo Date: Sun, 16 May 2021 06:08:30 +0200 Subject: [PATCH] Handle use cases where the function is not from main (#655) * Handle use cases where the function is not from main --- lib/binding/function.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/binding/function.go b/lib/binding/function.go index b7f654801..9a41f0e79 100644 --- a/lib/binding/function.go +++ b/lib/binding/function.go @@ -6,6 +6,7 @@ import ( "fmt" "reflect" "runtime" + "strings" "github.com/wailsapp/wails/lib/logger" ) @@ -27,6 +28,10 @@ func newBoundFunction(object interface{}) (*boundFunction, error) { objectType := reflect.TypeOf(object) name := runtime.FuncForPC(objectValue.Pointer()).Name() + if strings.Contains(name, "/") { + parts := strings.Split(name, "/") + name = parts[len(parts)-1] + } result := &boundFunction{ fullName: name,