evaluator: Format
This commit is contained in:
parent
4a9bce07d3
commit
40e58e2557
|
@ -17,7 +17,7 @@ func main() {
|
||||||
searchQuery := r.URL.Query().Get("query")
|
searchQuery := r.URL.Query().Get("query")
|
||||||
searchEngine := r.URL.Query().Get("engine")
|
searchEngine := r.URL.Query().Get("engine")
|
||||||
|
|
||||||
if (searchQuery == "" || searchEngine == "") {
|
if searchQuery == "" || searchEngine == "" {
|
||||||
http.Error(w, "400 Bad Request", http.StatusBadRequest)
|
http.Error(w, "400 Bad Request", http.StatusBadRequest)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -33,7 +33,7 @@ func main() {
|
||||||
|
|
||||||
func loadBangs() (bangs map[string]string) {
|
func loadBangs() (bangs map[string]string) {
|
||||||
data, err := ioutil.ReadFile("bangs.json")
|
data, err := ioutil.ReadFile("bangs.json")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatalf("Failed to read bangs: %v", err)
|
log.Fatalf("Failed to read bangs: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -75,7 +75,7 @@ func evaluateBang(searchQuery string, searchEngine string) (query string, engine
|
||||||
bang, query := parseBang(searchQuery)
|
bang, query := parseBang(searchQuery)
|
||||||
engine = bangs[bang]
|
engine = bangs[bang]
|
||||||
|
|
||||||
if (bang == "" || engine == ""){
|
if bang == "" || engine == "" {
|
||||||
return searchQuery, searchEngine
|
return searchQuery, searchEngine
|
||||||
} else {
|
} else {
|
||||||
return query, engine
|
return query, engine
|
||||||
|
|
Loading…
Reference in a new issue