From dd62ebd406a23184ec072d38894a5a3aac141b0d Mon Sep 17 00:00:00 2001 From: Luciano Nooijen Date: Sat, 11 Sep 2021 00:57:07 +0200 Subject: Use go embed for templates (#50) Go 1.16 includes a `//go:embed` directive that obviates the need for bindata. Use `//go:embed` instead of bindata for templates used in sally. Signed-off-by: Luciano Nooijen Co-authored-by: Abhinav Gupta --- handler.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'handler.go') diff --git a/handler.go b/handler.go index a29f399..b10b8f5 100644 --- a/handler.go +++ b/handler.go @@ -6,13 +6,14 @@ import ( "net/http" "github.com/julienschmidt/httprouter" + "go.uber.org/sally/templates" ) var ( indexTemplate = template.Must( - template.New("index.html").Parse(string(MustAsset("templates/index.html")))) + template.New("index.html").Parse(templates.Index)) packageTemplate = template.Must( - template.New("package.html").Parse(string(MustAsset("templates/package.html")))) + template.New("package.html").Parse(templates.Package)) ) // CreateHandler creates a Sally http.Handler -- cgit v1.2.3