mirror of
https://github.com/prymitive/karma
synced 2026-05-05 03:16:51 +00:00
fix(style): remove dead code
This commit is contained in:
23
assets.go
23
assets.go
@@ -1,14 +1,11 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"errors"
|
||||
"html/template"
|
||||
"net/http"
|
||||
"strings"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
|
||||
assetfs "github.com/elazarl/go-bindata-assetfs"
|
||||
log "github.com/sirupsen/logrus"
|
||||
)
|
||||
@@ -75,23 +72,3 @@ func loadTemplate(t *template.Template, path string) *template.Template {
|
||||
|
||||
return t
|
||||
}
|
||||
|
||||
func responseFromStaticFile(c *gin.Context, filepath string, contentType string) {
|
||||
if !staticFileSystem.Exists("/", filepath) {
|
||||
c.String(404, "Not found")
|
||||
return
|
||||
}
|
||||
|
||||
file, err := staticFileSystem.Open(filepath)
|
||||
if err != nil {
|
||||
c.AbortWithError(500, err)
|
||||
return
|
||||
}
|
||||
buf := bytes.NewBuffer(nil)
|
||||
_, err = buf.ReadFrom(file)
|
||||
if err != nil {
|
||||
c.AbortWithError(500, err)
|
||||
return
|
||||
}
|
||||
c.Data(200, contentType, buf.Bytes())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user