Skip to content

Commit b7022bd

Browse files
committed
style: fix linting issues
License: MIT Signed-off-by: Henrique Dias <hacdias@gmail.com>
1 parent 5afe2cc commit b7022bd

File tree

3 files changed

+6
-10
lines changed

3 files changed

+6
-10
lines changed

http/download.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,11 +79,10 @@ func downloadHandler(c *fb.Context, w http.ResponseWriter, r *http.Request) (int
7979

8080
func downloadFileHandler(c *fb.Context, w http.ResponseWriter, r *http.Request) (int, error) {
8181
file, err := os.Open(c.File.Path)
82-
defer file.Close()
83-
8482
if err != nil {
8583
return http.StatusInternalServerError, err
8684
}
85+
defer file.Close()
8786

8887
stat, err := file.Stat()
8988
if err != nil {

http/subtitle.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,13 @@ package http
22

33
import (
44
"bytes"
5-
fb "github.com/filebrowser/filebrowser"
65
"io/ioutil"
76
"net/http"
87
"os"
98
"path/filepath"
109
"regexp"
10+
11+
fb "github.com/filebrowser/filebrowser"
1112
)
1213

1314
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
3637
}
3738

3839
file, err := os.Open(c.File.Path)
39-
defer file.Close()
40-
4140
if err != nil {
4241
return http.StatusInternalServerError, err
4342
}
43+
defer file.Close()
4444

4545
stat, err := file.Stat()
4646
if err != nil {

staticgen/hugo.go

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -187,9 +187,6 @@ func (h Hugo) undraft(file string) error {
187187
// Setup sets up the plugin.
188188
func (h *Hugo) Setup() error {
189189
var err error
190-
if h.Exe, err = exec.LookPath("hugo"); err != nil {
191-
return err
192-
}
193-
194-
return nil
190+
h.Exe, err = exec.LookPath("hugo")
191+
return err
195192
}

0 commit comments

Comments
 (0)