added plain input as suggestion

This commit is contained in:
Niklas 2020-08-08 22:37:33 +02:00
parent c5f40e14ae
commit bd4620369d

7
ddg.go
View File

@ -25,12 +25,13 @@ func getSuggestions(query string) []string {
json.Unmarshal(body, &result)
if len(result) < 2 {
return []string{}
return []string{query}
}
rtn := make([]string, len(result[1].([]interface{})))
rtn := make([]string, len(result[1].([]interface{}))+1)
rtn[0] = query
for i, v := range result[1].([]interface{}) {
rtn[i] = v.(string)
rtn[i+1] = v.(string)
}
return rtn