binpack: go.felesatra.moe/binpack Files

Command binpack

Command binpack is a Go generator for packing static assets into Go packages.

For example, if you have a file base.html in your package containing:

<html><body>{{.body}}</body></html>

You can add a generate line anywhere in your package:

//go:generate binpack -name myTemplate base.html

Then running go generate will produce a myTemplate_packed.go containing:

// Code generated by "binpack -name myTemplate base.html"; DO NOT EDIT.

package foo

const myTemplate = "<html><body>{{.body}}</body></html>"

This also works for binary files, although the generated source is very inefficient as it is encoded as a string literal (but after compiling the data should not take up any extra space).

Package Files

binpack.go

Package main imports 8 packages (graph). Updated 2019-02-02. Refresh now. Tools for package owners.