diff options
Diffstat (limited to 'third_party/gerrit-queue/frontend/frontend.go')
-rw-r--r-- | third_party/gerrit-queue/frontend/frontend.go | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/third_party/gerrit-queue/frontend/frontend.go b/third_party/gerrit-queue/frontend/frontend.go index f00bc414a1c7..2cc65423f0e6 100644 --- a/third_party/gerrit-queue/frontend/frontend.go +++ b/third_party/gerrit-queue/frontend/frontend.go @@ -1,36 +1,34 @@ package frontend import ( + "embed" + "encoding/json" "fmt" "io/ioutil" "net/http" - "encoding/json" "html/template" - "github.com/rakyll/statik/fs" - "github.com/apex/log" "github.com/tweag/gerrit-queue/gerrit" "github.com/tweag/gerrit-queue/misc" - _ "github.com/tweag/gerrit-queue/statik" // register static assets "github.com/tweag/gerrit-queue/submitqueue" ) -//loadTemplate loads a list of templates, relative to the statikFS root, and a FuncMap, and returns a template object +//go:embed templates +var templates embed.FS + +//loadTemplate loads a list of templates, relative to the templates root, and a +//FuncMap, and returns a template object func loadTemplate(templateNames []string, funcMap template.FuncMap) (*template.Template, error) { if len(templateNames) == 0 { return nil, fmt.Errorf("templateNames can't be empty") } tmpl := template.New(templateNames[0]).Funcs(funcMap) - statikFS, err := fs.New() - if err != nil { - return nil, err - } for _, templateName := range templateNames { - r, err := statikFS.Open("/" + templateName) + r, err := templates.Open("/" + templateName) if err != nil { return nil, err } |