From 19068d048d46f446962772dc645c4202936939d7 Mon Sep 17 00:00:00 2001 From: Las Zenow Date: Mon, 29 Oct 2012 19:18:57 +0100 Subject: [PATCH] go fmt --- admin.go | 4 ++-- store.go | 16 ++++++++-------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/admin.go b/admin.go index 77e1887..f21de4e 100644 --- a/admin.go +++ b/admin.go @@ -8,7 +8,7 @@ import ( ) type settingsData struct { - S Status + S Status } func settingsHandler(w http.ResponseWriter, r *http.Request) { @@ -169,7 +169,7 @@ func newHandler(w http.ResponseWriter, r *http.Request) { } if len(r.URL.Path) > len("/new/") { - http.ServeFile(w, r, NEW_PATH + r.URL.Path[len("/new/"):]) + http.ServeFile(w, r, NEW_PATH+r.URL.Path[len("/new/"):]) return } diff --git a/store.go b/store.go index 2fc78ce..09580ca 100644 --- a/store.go +++ b/store.go @@ -14,7 +14,7 @@ import ( func ParseFile(path string) (string, error) { book := map[string]interface{}{} - e, err := epub.Open(NEW_PATH + path, 0) + e, err := epub.Open(NEW_PATH+path, 0) if err != nil { return "", err } @@ -68,8 +68,8 @@ func StoreBook(book Book) (path string, err error) { title := book.Title path = validFileName(BOOKS_PATH, title, ".epub") - oldPath := NEW_PATH+book.Path - r,_ := utf8.DecodeRuneInString(title) + oldPath := NEW_PATH + book.Path + r, _ := utf8.DecodeRuneInString(title) folder := string(r) if _, err = os.Stat(BOOKS_PATH + folder); err != nil { err = os.Mkdir(BOOKS_PATH+folder, os.ModePerm) @@ -96,7 +96,7 @@ func validFileName(path string, title string, extension string) string { title = strings.Replace(title, "/", "_", -1) title = strings.Replace(title, "?", "_", -1) title = strings.Replace(title, "#", "_", -1) - r,_ := utf8.DecodeRuneInString(title) + r, _ := utf8.DecodeRuneInString(title) folder := string(r) file := folder + "/" + title + extension _, err := os.Stat(path + file) @@ -127,10 +127,10 @@ func cleanStr(str string) string { } func storeImg(img []byte, title, extension string) (string, string) { - r,_ := utf8.DecodeRuneInString(title) + r, _ := utf8.DecodeRuneInString(title) folder := string(r) if _, err := os.Stat(COVER_PATH + folder); err != nil { - err = os.Mkdir(COVER_PATH + folder, os.ModePerm) + err = os.Mkdir(COVER_PATH+folder, os.ModePerm) if err != nil { return "", "" } @@ -146,11 +146,11 @@ func storeImg(img []byte, title, extension string) (string, string) { file.Write(img) /* resize img */ - resize := append(strings.Split(RESIZE_CMD, " "), COVER_PATH + imgPath, COVER_PATH + imgPath) + resize := append(strings.Split(RESIZE_CMD, " "), COVER_PATH+imgPath, COVER_PATH+imgPath) cmd := exec.Command(resize[0], resize[1:]...) cmd.Run() imgPathSmall := validFileName(COVER_PATH, title, "_small"+extension) - resize = append(strings.Split(RESIZE_THUMB_CMD, " "), COVER_PATH + imgPath, COVER_PATH + imgPathSmall) + resize = append(strings.Split(RESIZE_THUMB_CMD, " "), COVER_PATH+imgPath, COVER_PATH+imgPathSmall) cmd = exec.Command(resize[0], resize[1:]...) cmd.Run() return imgPath, imgPathSmall