From 24bb024c18d2e3c53ca0e83a2174c7ee2493fc07 Mon Sep 17 00:00:00 2001 From: Eliot Whalan Date: Mon, 4 Jul 2016 12:29:59 +1000 Subject: [PATCH] Fix up golint errors --- pastebin.go | 25 +++++++++---------------- 1 file changed, 9 insertions(+), 16 deletions(-) diff --git a/pastebin.go b/pastebin.go index c44e26d..3a0a6f8 100644 --- a/pastebin.go +++ b/pastebin.go @@ -1,4 +1,4 @@ -// pastebin is a simple modern and powerful pastebin service +// package pastebin is a simple modern and powerful pastebin service package pastebin import ( @@ -33,7 +33,7 @@ const ( LENGTH = 6 // PORT that pastebin will listen on PORT = ":9900" - // USERNAME for databse + // USERNAME for database USERNAME = "" // PASS database password PASS = "" @@ -183,12 +183,9 @@ func delHandler(w http.ResponseWriter, r *http.Request) { check(err) _, err = res.RowsAffected() - if err == sql.ErrNoRows { - io.WriteString(w, "Error invalid paste") - } else { + if err != sql.ErrNoRows { io.WriteString(w, id+" deleted") } - } // saveHandler @@ -276,17 +273,13 @@ func getPaste(paste string, lang string) (string, string) { if err == sql.ErrNoRows { return "Error invalid paste", "" - } else { - if lang == "" { - return html.UnescapeString(s), html.UnescapeString(title) - } else { - high, err := highlight(s, lang) - check(err) - return high, html.UnescapeString(title) - - } } - + if lang != "" { + high, err := highlight(s, lang) + check(err) + return high, html.UnescapeString(title) + } + return html.UnescapeString(s), html.UnescapeString(title) } var templates = template.Must(template.ParseFiles("assets/paste.html", "assets/index.html", "assets/clone.html"))