code: func generate(t *template.Template, pkg *build.Package, assets assetMap, assetExts []string, path string) error {
  	keys := make([]string, 0, len(assets))
  	for k := range assets {
  		keys = append(keys, k)
  	}
  	sort.Strings(keys)
  
  	data := templateData{
  		Patterns:    assetExts,
  		PackageName: pkg.Name,
  	}
  	for _, key := range keys {
  		data.Assets = append(data.Assets, assets[key])
  	}
  
  	out := bytes.Buffer{}
  	if err := t.Execute(&out, data); err != nil {
  		return err
  	}
  
  	formatted, err := gofmt(out.Bytes())
  	if err != nil {
  		return fmt.Errorf("can't gofmt %s - %s", path, err)
  	}
  
  	return ioutil.WriteFile(path, formatted, 0666)
  }
docs: // generate executes the template, runs output through gofmt and dumps it to disk.