Very simple generator used to embed some file into executable. Useful to store template files.
go get github.com/Axili39/res2go
go build
go install
usage:
Usage of ./res2go:
-o string
output file (default "resources.go")
-package string
package name (default "resources")
-prefix string
add prefix to all exported function
examples:
res2go ./resources
res2go ./templates/index.html ./templates/style.js
res2go -package myresources index.html
res2go -package myresources -o rsrc/rsrc.go resources/*.templates
res2go -package main -o rsrc.go -prefix Rsrc resources/*
Example in Go code:
//go:generate res2go -package resources -o resources/resources.go resources/*.templates
import (
"./resources"
)
func main() {
resources.Init()
myfile = resources.Files["resources/example.template"]
fmt.Println(string(myfile))
}