mirror of
https://github.com/wavetermdev/wails.git
synced 2026-08-05 13:53:43 -07:00
Bugfix/incorrect bindings (#1383)
* Print struct path * Better handling of anon structs
This commit is contained in:
@@ -152,11 +152,13 @@ func (b *Bindings) AddStructToGenerateTS(packageName string, structName string,
|
||||
for i := 0; i < structType.NumField(); i++ {
|
||||
field := structType.Field(i)
|
||||
if field.Anonymous {
|
||||
return
|
||||
continue
|
||||
}
|
||||
|
||||
kind := field.Type.Kind()
|
||||
if kind == reflect.Struct {
|
||||
if field.PkgPath == "" {
|
||||
continue
|
||||
}
|
||||
fqname := field.Type.String()
|
||||
sName := strings.Split(fqname, ".")[1]
|
||||
pName := getPackageName(fqname)
|
||||
@@ -166,6 +168,9 @@ func (b *Bindings) AddStructToGenerateTS(packageName string, structName string,
|
||||
b.AddStructToGenerateTS(pName, sName, s)
|
||||
}
|
||||
} else if kind == reflect.Ptr && field.Type.Elem().Kind() == reflect.Struct {
|
||||
if field.PkgPath == "" {
|
||||
continue
|
||||
}
|
||||
fqname := field.Type.String()
|
||||
sName := strings.Split(fqname, ".")[1]
|
||||
pName := getPackageName(fqname)
|
||||
|
||||
Reference in New Issue
Block a user