From bd4620369d6ddf868f16638c27d371a18476dfa9 Mon Sep 17 00:00:00 2001 From: Niklas Date: Sat, 8 Aug 2020 22:37:33 +0200 Subject: [PATCH] added plain input as suggestion --- ddg.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/ddg.go b/ddg.go index d0058d5..f3219dc 100644 --- a/ddg.go +++ b/ddg.go @@ -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