mirror of
https://github.com/dutchcoders/transfer.sh.git
synced 2020-11-18 19:53:40 -08:00
Fix linting errors
This commit is contained in:
parent
a3fe3feafa
commit
d0dbdd3591
@ -60,8 +60,8 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
html_templates = initHTMLTemplates()
|
htmlTemplates = initHTMLTemplates()
|
||||||
text_templates = initTextTemplates()
|
textTemplates = initTextTemplates()
|
||||||
)
|
)
|
||||||
|
|
||||||
func stripPrefix(path string) string {
|
func stripPrefix(path string) string {
|
||||||
@ -160,7 +160,7 @@ func (s *Server) previewHandler(w http.ResponseWriter, r *http.Request) {
|
|||||||
contentLength,
|
contentLength,
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := html_templates.ExecuteTemplate(w, templatePath, data); err != nil {
|
if err := htmlTemplates.ExecuteTemplate(w, templatePath, data); err != nil {
|
||||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -174,12 +174,12 @@ func (s *Server) viewHandler(w http.ResponseWriter, r *http.Request) {
|
|||||||
// vars := mux.Vars(r)
|
// vars := mux.Vars(r)
|
||||||
|
|
||||||
if acceptsHTML(r.Header) {
|
if acceptsHTML(r.Header) {
|
||||||
if err := html_templates.ExecuteTemplate(w, "index.html", nil); err != nil {
|
if err := htmlTemplates.ExecuteTemplate(w, "index.html", nil); err != nil {
|
||||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if err := text_templates.ExecuteTemplate(w, "index.txt", nil); err != nil {
|
if err := textTemplates.ExecuteTemplate(w, "index.txt", nil); err != nil {
|
||||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -220,8 +220,8 @@ func (s *Server) Run() {
|
|||||||
|
|
||||||
fs = http.Dir(s.webPath)
|
fs = http.Dir(s.webPath)
|
||||||
|
|
||||||
html_templates, _ = html_templates.ParseGlob(s.webPath + "*.html")
|
htmlTemplates, _ = htmlTemplates.ParseGlob(s.webPath + "*.html")
|
||||||
text_templates, _ = text_templates.ParseGlob(s.webPath + "*.txt")
|
textTemplates, _ = textTemplates.ParseGlob(s.webPath + "*.txt")
|
||||||
} else {
|
} else {
|
||||||
fs = &assetfs.AssetFS{
|
fs = &assetfs.AssetFS{
|
||||||
Asset: web.Asset,
|
Asset: web.Asset,
|
||||||
@ -238,8 +238,8 @@ func (s *Server) Run() {
|
|||||||
log.Panicf("Unable to parse: path=%s, err=%s", path, err)
|
log.Panicf("Unable to parse: path=%s, err=%s", path, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
html_templates.New(stripPrefix(path)).Parse(string(bytes))
|
htmlTemplates.New(stripPrefix(path)).Parse(string(bytes))
|
||||||
text_templates.New(stripPrefix(path)).Parse(string(bytes))
|
textTemplates.New(stripPrefix(path)).Parse(string(bytes))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user