Switch to Go 1.16 embed functionality (#42)

commit 8b9ecaaa2fe8b65e3a32317e2979387af39b5262
Author: Vic Demuzere <vic@demuzere.be>
Date:   Tue Aug 24 15:14:38 2021 +0200

    Switch to Go 1.6 embed functionality

    This means the go-bindata compile-time dependency is no longer needed.

closes #42

Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
Knut Ahlers 2021-09-06 12:37:52 +02:00
parent f1751aff86
commit 71fa3b7590
No known key found for this signature in database
GPG key ID: 0066F03ED215AD7D
5 changed files with 10 additions and 63118 deletions

View file

@ -1,8 +1,7 @@
package main
//go:generate go-bindata -pkg $GOPACKAGE -o assets.go -modtime 1 -md5checksum ./frontend/...
import (
"embed"
"fmt"
"mime"
"net/http"
@ -29,6 +28,9 @@ var (
version = "dev"
)
//go:embed frontend/*
var assets embed.FS
func init() {
if err := rconfig.ParseAndValidate(&cfg); err != nil {
log.Fatalf("Error parsing CLI arguments: %s", err)
@ -75,7 +77,7 @@ func assetDelivery(res http.ResponseWriter, r *http.Request) {
}
ext := assetName[dot:]
assetData, err := Asset(path.Join("frontend", assetName))
assetData, err := assets.ReadFile(path.Join("frontend", assetName))
if err != nil {
http.Error(res, "404 not found", http.StatusNotFound)
return