Fix gopls issues

This commit is contained in:
Daan Sprenkels 2021-05-07 10:17:17 +02:00
parent 1fe9553cc9
commit b8d1ca459c
4 changed files with 4 additions and 17 deletions

View File

@ -28,7 +28,7 @@ import (
func bindataRead(data []byte, name string) ([]byte, error) { func bindataRead(data []byte, name string) ([]byte, error) {
gz, err := gzip.NewReader(bytes.NewBuffer(data)) gz, err := gzip.NewReader(bytes.NewBuffer(data))
if err != nil { 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 var buf bytes.Buffer
@ -36,7 +36,7 @@ func bindataRead(data []byte, name string) ([]byte, error) {
clErr := gz.Close() clErr := gz.Close()
if err != nil { if err != nil {
return nil, fmt.Errorf("Read %q: %v", name, err) return nil, fmt.Errorf("read %q: %v", name, err)
} }
if clErr != nil { if clErr != nil {
return nil, err return nil, err

View File

@ -7,9 +7,6 @@ import (
"github.com/pkg/errors" "github.com/pkg/errors"
) )
// Where to store the uploaded files
var fileStoreDir = ""
// FileUploadFileSystem is a HTTP filesystem handler // FileUploadFileSystem is a HTTP filesystem handler
type FileUploadFileSystem struct { type FileUploadFileSystem struct {
fs http.FileSystem fs http.FileSystem

View File

@ -45,8 +45,6 @@ const (
viewShowMeta viewShowMeta
) )
const cookieDeleteToken = "owner_token"
type canDelete uint type canDelete uint
const ( const (
@ -221,7 +219,6 @@ func (rl *rushlink) viewPasteHandlerInnerMeta(w http.ResponseWriter, r *http.Req
status = http.StatusOK status = http.StatusOK
} }
rl.render(w, r, status, "pasteMeta", data) rl.render(w, r, status, "pasteMeta", data)
return
} }
func (rl *rushlink) viewActionSuccess(w http.ResponseWriter, r *http.Request, p *db.Paste, fu *db.FileUpload) { 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(), "CanDeleteBool": cd.Bool(),
} }
rl.render(w, r, 0, "pasteMeta", data) rl.render(w, r, 0, "pasteMeta", data)
return
} }
func (rl *rushlink) newPasteHandler(w http.ResponseWriter, r *http.Request) { func (rl *rushlink) newPasteHandler(w http.ResponseWriter, r *http.Request) {

View File

@ -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")))) var htmlBaseTemplate *html.Template = html.Must(html.New("").Parse(string(MustAsset("templates/html/base.html.tmpl"))))
// Template collections // Template collections
var textTemplates = make(map[string]*text.Template, 0) var textTemplates = make(map[string]*text.Template)
var htmlTemplates = make(map[string]*html.Template, 0) var htmlTemplates = make(map[string]*html.Template)
// Used by resolveResponseContentType // Used by resolveResponseContentType
var acceptHeaderMediaRangeRegex = regexp.MustCompile(`^\s*([^()<>@,;:\\"/\[\]?.=]+)/([^()<>@,;:\\"/\[\]?.=]+)\s*$`) var acceptHeaderMediaRangeRegex = regexp.MustCompile(`^\s*([^()<>@,;:\\"/\[\]?.=]+)/([^()<>@,;:\\"/\[\]?.=]+)\s*$`)
@ -75,10 +75,6 @@ func mustMatch(pattern, name string) bool {
return m 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{}) { func mapExtend(m map[string]interface{}, key string, value interface{}) {
if m[key] != nil { if m[key] != nil {
return return
@ -191,10 +187,8 @@ func (rl *rushlink) resolveRootURL(r *http.Request) string {
switch forwardedScheme { switch forwardedScheme {
case "http": case "http":
scheme = "http" scheme = "http"
break
case "https": case "https":
scheme = "https" scheme = "https"
break
} }
// Guess host // Guess host
host := r.Host host := r.Host