first commit
This commit is contained in:
26
fs-demo.go
Normal file
26
fs-demo.go
Normal file
@ -0,0 +1,26 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"embed"
|
||||
"fmt"
|
||||
"html/template"
|
||||
"os"
|
||||
)
|
||||
|
||||
|
||||
//go:embed assets/*
|
||||
var assetData embed.FS
|
||||
|
||||
func main() {
|
||||
|
||||
t, err := template.ParseFS(assetData, "assets/report.html")
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
}
|
||||
templateData := struct {
|
||||
Title string
|
||||
}{
|
||||
Title: "File inside Go",
|
||||
}
|
||||
t.Execute(os.Stdout, templateData)
|
||||
}
|
Reference in New Issue
Block a user