From b8d1ca459c8574f4847ecdecf6c8dec973c081ca Mon Sep 17 00:00:00 2001 From: Daan Sprenkels Date: Fri, 7 May 2021 10:17:17 +0200 Subject: [PATCH] Fix gopls issues --- bindata.go | 4 ++-- fileupload.go | 3 --- handlers.go | 4 ---- views.go | 10 ++-------- 4 files changed, 4 insertions(+), 17 deletions(-) diff --git a/bindata.go b/bindata.go index 6872e98..a235ee3 100644 --- a/bindata.go +++ b/bindata.go @@ -28,7 +28,7 @@ import ( func bindataRead(data []byte, name string) ([]byte, error) { gz, err := gzip.NewReader(bytes.NewBuffer(data)) if err != nil { - return nil, fmt.Errorf("Read %q: %v", name, err) + return nil, fmt.Errorf("read %q: %v", name, err) } var buf bytes.Buffer @@ -36,7 +36,7 @@ func bindataRead(data []byte, name string) ([]byte, error) { clErr := gz.Close() if err != nil { - return nil, fmt.Errorf("Read %q: %v", name, err) + return nil, fmt.Errorf("read %q: %v", name, err) } if clErr != nil { return nil, err diff --git a/fileupload.go b/fileupload.go index 6c0c2e2..57dfca3 100644 --- a/fileupload.go +++ b/fileupload.go @@ -7,9 +7,6 @@ import ( "github.com/pkg/errors" ) -// Where to store the uploaded files -var fileStoreDir = "" - // FileUploadFileSystem is a HTTP filesystem handler type FileUploadFileSystem struct { fs http.FileSystem diff --git a/handlers.go b/handlers.go index 3dd58aa..1ea5ca2 100644 --- a/handlers.go +++ b/handlers.go @@ -45,8 +45,6 @@ const ( viewShowMeta ) -const cookieDeleteToken = "owner_token" - type canDelete uint const ( @@ -221,7 +219,6 @@ func (rl *rushlink) viewPasteHandlerInnerMeta(w http.ResponseWriter, r *http.Req status = http.StatusOK } rl.render(w, r, status, "pasteMeta", data) - return } func (rl *rushlink) viewActionSuccess(w http.ResponseWriter, r *http.Request, p *db.Paste, fu *db.FileUpload) { @@ -244,7 +241,6 @@ func (rl *rushlink) viewActionSuccess(w http.ResponseWriter, r *http.Request, p "CanDeleteBool": cd.Bool(), } rl.render(w, r, 0, "pasteMeta", data) - return } func (rl *rushlink) newPasteHandler(w http.ResponseWriter, r *http.Request) { diff --git a/views.go b/views.go index 1aa3306..fba64b7 100644 --- a/views.go +++ b/views.go @@ -28,8 +28,8 @@ var textBaseTemplate *text.Template = text.Must(text.New("").Parse(string(MustAs var htmlBaseTemplate *html.Template = html.Must(html.New("").Parse(string(MustAsset("templates/html/base.html.tmpl")))) // Template collections -var textTemplates = make(map[string]*text.Template, 0) -var htmlTemplates = make(map[string]*html.Template, 0) +var textTemplates = make(map[string]*text.Template) +var htmlTemplates = make(map[string]*html.Template) // Used by resolveResponseContentType var acceptHeaderMediaRangeRegex = regexp.MustCompile(`^\s*([^()<>@,;:\\"/\[\]?.=]+)/([^()<>@,;:\\"/\[\]?.=]+)\s*$`) @@ -75,10 +75,6 @@ func mustMatch(pattern, name string) bool { return m } -func parseFail(tmplName string, err error) { - panic(errors.Wrapf(err, "parsing of %v failed", tmplName)) -} - func mapExtend(m map[string]interface{}, key string, value interface{}) { if m[key] != nil { return @@ -191,10 +187,8 @@ func (rl *rushlink) resolveRootURL(r *http.Request) string { switch forwardedScheme { case "http": scheme = "http" - break case "https": scheme = "https" - break } // Guess host host := r.Host