Simplify code in a few places

Found by running `gosimple ./...`
This commit is contained in:
Lucas Clemente
2017-04-05 22:03:25 +01:00
parent b26d9f92b8
commit 013d7fdb30
13 changed files with 22 additions and 49 deletions

View File

@@ -71,8 +71,7 @@ func init() {
// maximum accepted file size is 1 GB
http.HandleFunc("/demo/upload", func(w http.ResponseWriter, r *http.Request) {
if r.Method == http.MethodPost {
var err error
err = r.ParseMultipartForm(1 << 30) // 1 GB
err := r.ParseMultipartForm(1 << 30) // 1 GB
if err == nil {
var file multipart.File
file, _, err = r.FormFile("uploadfile")
@@ -86,7 +85,7 @@ func init() {
fmt.Fprintf(w, "%x", md5)
return
}
err = errors.New("Couldn't get uploaded file size.")
err = errors.New("couldn't get uploaded file size")
}
}
if err != nil {