Conver regular files into a single golang package
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.


Although there are many golang programs who transfer files into go packages, such as jteeuwen/go-bindata, a-urth/go-bindata, and go-bindata-assetfs, but I still felt not good with them.

So I wrote one myself.



Install the bindata cmd with:

go get


Usage of ./bindata:
  -pkg string
        target package name (default "")
  -prefix string
        resource prefix, used for http server (default "/")
  -resource string
        resource dir
  -target string
        where to put the generated files, default is the package's path

Generate embedded data

For example, if you want to generate a asset package, who's path is, the resource files are located in resource/ directory, then yoy can use the command below:

bindata -pkg \
    -resource "resource/"

After execute the command:

$ ls $GOPATH/src/
asset.go  bindata.go

And now, you can use this asset package with:

package main

import (


func main() {
    http.Handle("/", asset.Data)
    http.ListenAndServe(":8080", nil)

Look at the example folder for more details and usage examples.