1 Star 0 Fork 0

marker / go-bindata

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
toc.go 1.03 KB
一键复制 编辑 原始数据 按行查看 历史
// This work is subject to the CC0 1.0 Universal (CC0 1.0) Public Domain Dedication
// license. Its contents can be found at:
// http://creativecommons.org/publicdomain/zero/1.0/
package main
import (
"fmt"
"io"
"io/ioutil"
"path/filepath"
"strings"
)
// createTOC writes a table of contents file to the given location.
func createTOC(dir, pkgname string) error {
file := filepath.Join(dir, "bindata-toc.go")
code := fmt.Sprintf(`package %s
// Global Table of Contents map. Generated by go-bindata.
// After startup of the program, all generated data files will
// put themselves in this map. The key is the full filename, as
// supplied to go-bindata.
var go_bindata = make(map[string]func() []byte)`, pkgname)
return ioutil.WriteFile(file, []byte(code), 0600)
}
// writeTOCInit writes the TOC init function for a given data file.
func writeTOCInit(output io.Writer, filename, prefix, funcname string) {
filename = strings.Replace(filename, prefix, "", 1)
fmt.Fprintf(output, `
func init() {
go_bindata[%q] = %s
}
`, filename, funcname)
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/marker/go-bindata.git
git@gitee.com:marker/go-bindata.git
marker
go-bindata
go-bindata
v2.0.1

搜索帮助

344bd9b3 5694891 D2dac590 5694891