Fix up golint errors
This commit is contained in:
parent
741511897c
commit
601a5d6ee1
19
pastebin.go
19
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
|
package pastebin
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
@ -33,7 +33,7 @@ const (
|
||||||
LENGTH = 6
|
LENGTH = 6
|
||||||
// PORT that pastebin will listen on
|
// PORT that pastebin will listen on
|
||||||
PORT = ":9900"
|
PORT = ":9900"
|
||||||
// USERNAME for databse
|
// USERNAME for database
|
||||||
USERNAME = ""
|
USERNAME = ""
|
||||||
// PASS database password
|
// PASS database password
|
||||||
PASS = ""
|
PASS = ""
|
||||||
|
@ -183,12 +183,9 @@ func delHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
check(err)
|
check(err)
|
||||||
|
|
||||||
_, err = res.RowsAffected()
|
_, err = res.RowsAffected()
|
||||||
if err == sql.ErrNoRows {
|
if err != sql.ErrNoRows {
|
||||||
io.WriteString(w, "Error invalid paste")
|
|
||||||
} else {
|
|
||||||
io.WriteString(w, id+" deleted")
|
io.WriteString(w, id+" deleted")
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// saveHandler
|
// saveHandler
|
||||||
|
@ -276,17 +273,13 @@ func getPaste(paste string, lang string) (string, string) {
|
||||||
|
|
||||||
if err == sql.ErrNoRows {
|
if err == sql.ErrNoRows {
|
||||||
return "Error invalid paste", ""
|
return "Error invalid paste", ""
|
||||||
} else {
|
}
|
||||||
if lang == "" {
|
if lang != "" {
|
||||||
return html.UnescapeString(s), html.UnescapeString(title)
|
|
||||||
} else {
|
|
||||||
high, err := highlight(s, lang)
|
high, err := highlight(s, lang)
|
||||||
check(err)
|
check(err)
|
||||||
return high, html.UnescapeString(title)
|
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"))
|
var templates = template.Must(template.ParseFiles("assets/paste.html", "assets/index.html", "assets/clone.html"))
|
||||||
|
|
Loading…
Reference in New Issue