mirror of
https://github.com/wailsapp/wails.git
synced 2025-05-02 19:50:15 +08:00
Add compatibility for Go1.17 (#1605)
This commit is contained in:
parent
41126759cf
commit
461d0c4448
@ -129,7 +129,13 @@ func goTypeToJSDocType(input string, importNamespaces *slicer.StringSlicer) stri
|
|||||||
return "string"
|
return "string"
|
||||||
case strings.HasPrefix(input, "map"):
|
case strings.HasPrefix(input, "map"):
|
||||||
temp := strings.TrimPrefix(input, "map[")
|
temp := strings.TrimPrefix(input, "map[")
|
||||||
keyType, valueType, _ := strings.Cut(temp, "]")
|
// Split the string into the key and value types
|
||||||
|
tempSplit := strings.SplitN(temp, "]", 2)
|
||||||
|
if len(tempSplit) < 2 {
|
||||||
|
panic("Invalid map type provided: " + input)
|
||||||
|
}
|
||||||
|
keyType := tempSplit[0]
|
||||||
|
valueType := tempSplit[1]
|
||||||
return fmt.Sprintf("{[key: %s]: %s}", goTypeToJSDocType(keyType, importNamespaces), goTypeToJSDocType(valueType, importNamespaces))
|
return fmt.Sprintf("{[key: %s]: %s}", goTypeToJSDocType(keyType, importNamespaces), goTypeToJSDocType(valueType, importNamespaces))
|
||||||
case strings.HasPrefix(input, "[]"):
|
case strings.HasPrefix(input, "[]"):
|
||||||
arrayType := goTypeToJSDocType(input[2:], importNamespaces)
|
arrayType := goTypeToJSDocType(input[2:], importNamespaces)
|
||||||
|
Loading…
Reference in New Issue
Block a user