2016-07-14 10:55:04 +00:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
2023-11-11 14:27:37 +00:00
|
|
|
"embed"
|
2016-07-14 10:55:04 +00:00
|
|
|
"fmt"
|
|
|
|
)
|
|
|
|
|
2023-11-11 14:27:37 +00:00
|
|
|
//go:embed assets/*
|
|
|
|
var assetFS embed.FS
|
2016-07-14 10:55:04 +00:00
|
|
|
|
2023-11-11 14:27:37 +00:00
|
|
|
func asset(name string) ([]byte, error) {
|
|
|
|
data, err := assetFS.ReadFile(name)
|
2016-07-14 10:55:04 +00:00
|
|
|
if err != nil {
|
2023-11-11 14:27:37 +00:00
|
|
|
return data, fmt.Errorf("reading asset: %w", err)
|
2016-07-14 10:55:04 +00:00
|
|
|
}
|
|
|
|
|
2023-11-11 14:27:37 +00:00
|
|
|
return data, nil
|
2016-07-14 10:55:04 +00:00
|
|
|
}
|
|
|
|
|
2023-11-11 14:27:37 +00:00
|
|
|
func mustAsset(name string) []byte {
|
|
|
|
data, err := asset(name)
|
2016-07-14 10:55:04 +00:00
|
|
|
if err != nil {
|
2023-11-11 14:27:37 +00:00
|
|
|
panic(err)
|
2016-07-14 10:55:04 +00:00
|
|
|
}
|
2023-11-11 14:27:37 +00:00
|
|
|
return data
|
2016-07-14 10:55:04 +00:00
|
|
|
}
|