
zpack is yet another way to pack static data in Go binaries.
Why? Because I don't like relying on external binaries, and many other solutions
do. zpack just writes data to the specified file as []byte().
Basic usage:
package main
import (
"fmt"
"os"
"zgo.at/zpack"
)
func main() {
err := zpack.Pack(map[string]map[string]string{
"./db/pack.go": map[string]string{
"Schema": "./db/schema.sql",
},
"./handlers/pack.go": map[string]string{
"packPublic": "./public",
"packTpl": "./tpl",
},
})
if err != nil {
fmt.Fprintln(os.Stderr, err)
os.Exit(1)
}
}
Then go generate ./... and presto!