From f4982cff5ed73a7a7dda5698d90bbff204222204 Mon Sep 17 00:00:00 2001 From: Henrique Dias Date: Tue, 7 Aug 2018 13:34:06 +0100 Subject: [PATCH] style: fix linting issues License: MIT Signed-off-by: Henrique Dias Former-commit-id: 10657ab9cff2ee94dd7c0082bfe2cbfa07865022 [formerly 5501af1ace43a089ac4222cf9da2f5176242f817] [formerly 39c72e2e9235a822a30c0b338f55c441f3b3024d [formerly b7022bdfe32c2234e28315e01a440dc882a732c5]] Former-commit-id: 5941e4ab1295b90371ba60003f69939559dc8060 [formerly 3513d92ba403133d7b53aa19c92e4356f9e68b75] Former-commit-id: 3657f6f659e893928bd2b9f64afecdaa41d587a6 --- http/download.go | 3 +-- http/subtitle.go | 6 +++--- staticgen/hugo.go | 7 ++----- 3 files changed, 6 insertions(+), 10 deletions(-) diff --git a/http/download.go b/http/download.go index 26431d92..a1a1d08e 100644 --- a/http/download.go +++ b/http/download.go @@ -79,11 +79,10 @@ func downloadHandler(c *fb.Context, w http.ResponseWriter, r *http.Request) (int func downloadFileHandler(c *fb.Context, w http.ResponseWriter, r *http.Request) (int, error) { file, err := os.Open(c.File.Path) - defer file.Close() - if err != nil { return http.StatusInternalServerError, err } + defer file.Close() stat, err := file.Stat() if err != nil { diff --git a/http/subtitle.go b/http/subtitle.go index be54cd55..e83f295b 100644 --- a/http/subtitle.go +++ b/http/subtitle.go @@ -2,12 +2,13 @@ package http import ( "bytes" - fb "github.com/filebrowser/filebrowser" "io/ioutil" "net/http" "os" "path/filepath" "regexp" + + fb "github.com/filebrowser/filebrowser" ) func subtitlesHandler(c *fb.Context, w http.ResponseWriter, r *http.Request) (int, error) { @@ -36,11 +37,10 @@ func subtitleHandler(c *fb.Context, w http.ResponseWriter, r *http.Request) (int } file, err := os.Open(c.File.Path) - defer file.Close() - if err != nil { return http.StatusInternalServerError, err } + defer file.Close() stat, err := file.Stat() if err != nil { diff --git a/staticgen/hugo.go b/staticgen/hugo.go index 284e46e7..d9e989a6 100644 --- a/staticgen/hugo.go +++ b/staticgen/hugo.go @@ -187,9 +187,6 @@ func (h Hugo) undraft(file string) error { // Setup sets up the plugin. func (h *Hugo) Setup() error { var err error - if h.Exe, err = exec.LookPath("hugo"); err != nil { - return err - } - - return nil + h.Exe, err = exec.LookPath("hugo") + return err }