func RestoreAsset(dir, name string) error {
	data, err := Asset(name)
	if err != nil {
		return err
	}
	info, err := AssetInfo(name)
	if err != nil {
		return err
	}
	data = bytes.Replace(data, projNameTpl, projNameBytes, -1)
	data = bytes.Replace(data, projPathTpl, projPathBytes, -1)
	if strings.HasSuffix(name, ".go") {
		data, _ = format.Source(data)
	}
	err = os.MkdirAll(_filePath(dir, filepath.Dir(name)), os.FileMode(0755))
	if err != nil {
		return err
	}
	err = ioutil.WriteFile(_filePath(dir, name), data, info.Mode())
	if err != nil {
		return err
	}
	err = os.Chtimes(_filePath(dir, name), info.ModTime(), info.ModTime())
	if err != nil {
		return err
	}
	fmt.Printf("generate %s\n", string(projPathBytes)+"/"+_filePath(dir, name))
	return nil
}
RestoreAsset restores an asset under the given directory
package tpl
import (
	"bytes"
	"fmt"
	"go/format"
	"io/ioutil"
	"os"
	"path/filepath"
	"strings"
	"github.com/xiaoenai/tp-micro/v6/micro/info"
)