// genAll creates all the zips and tarballs, and returns their filenames.
338100
func genAll() ([]string, error) {
	zipSource()
	for _, platform := range []string{"linux", "darwin", "windows"} {
		genBinaries(platform)
		packBinaries(platform)
	}
	getVersions()
	return []string{
		"perkeep-darwin.tar.gz",
		"perkeep-linux.tar.gz",
		"perkeep-src.zip",
		"perkeep-windows.zip",
	}, nil
}
1170222
func (m *Metric) gen() <-chan string {
	out := make(chan string, len(metricsNames))
	for _, n := range metricsNames {
		out <- n
	}
	close(out)
	return out
}
18607
func (e *Error) GenByArgs(args ...interface{}) *Error {
	err := *e
	err.args = args
	_, err.file, err.line, _ = runtime.Caller(1)
	return &err
}
407993
func (z *ZipFile) AddAll(dir string, includeCurrentFolder bool) error {
	dir = path.Clean(dir)
	return addAll(dir, dir, includeCurrentFolder, func(info os.FileInfo, file io.Reader, entryName string) (err error) {
		// Create a header based off of the fileinfo
		header, err := zip.FileInfoHeader(info)
		if err != nil {
			return err
		}

		// If it's a file, set the compression method to deflate (leave directories uncompressed)
		if !info.IsDir() {
			header.Method = zip.Deflate
		}

		// Set the header's name to what we want--it may not include the top folder
		header.Name = entryName

		// Add a trailing slash if the entry is a directory
		if info.IsDir() {
			header.Name += "/"
		}

		// Get a writer in the archive based on our header
		writer, err := z.Writer.CreateHeader(header)
		if err != nil {
			return err
		}

		// If we have a file to write (i.e., not a directory) then pipe the file into the archive writer
		if file != nil {
			if _, err := io.Copy(writer, file); err != nil {
				return err
			}
		}

		return nil
	})
}
745234
func (t Target) all() []string {
	all := t.initial
	for _, name := range t.dependencies {
		all = append(all, name)
	}
	sort.Strings(all)
	return all
}
491276
func (g Generationer) StorageGeneration() (initTime time.Time, random string, err error) {
	f, err := os.Open(g.generationFile())
	if os.IsNotExist(err) {
		if err = g.ResetStorageGeneration(); err != nil {
			return
		}
		f, err = os.Open(g.generationFile())
	}
	if err != nil {
		return
	}
	defer f.Close()
	bs, err := ioutil.ReadAll(f)
	if err != nil {
		return
	}
	if i := bytes.IndexByte(bs, '\n'); i != -1 {
		bs = bs[:i]
	}
	if fi, err := f.Stat(); err == nil {
		initTime = fi.ModTime()
	}
	random = string(bs)
	return
}
338829
func (logger *Logger) genLog(level Level, message string) string {
	fs := make([]interface{}, len(logger.recordArgs))
	r := new(record)
	r.message = message
	r.level = level
	r.genNonRuntime(logger)
	if logger.runtime {
		r.genRuntime()
	}
	for k, v := range logger.recordArgs {
		fs[k] = fields[v](logger, r)
	}
	return fmt.Sprintf(logger.recordFormat, fs...)
}
325232
func OneGenOf(gens ...gopter.Gen) gopter.Gen {
	if len(gens) == 0 {
		return Fail(reflect.TypeOf(nil))
	}
	return func(genParams *gopter.GenParameters) *gopter.GenResult {
		idx := genParams.Rng.Intn(len(gens))
		return gens[idx](genParams)
	}
}
536559
func (engine *Engine) DumpAll(w io.Writer, tp ...core.DbType) error {
	tables, err := engine.DBMetas()
	if err != nil {
		return err
	}
	return engine.DumpTables(tables, w, tp...)
}
128351
func (a *Arbitraries) GenForType(rt reflect.Type) gopter.Gen {
	if gen, ok := a.generators[rt]; ok {
		return gen
	}
	return a.genForKind(rt)
}
293467
func (list *Lists) GenerateFilelist(out io.Writer) error {
	w := bufio.NewWriter(out)
	for _, pair := range list.getPairs() {
		dLen := len(*pair.data)
		toWrite := []string{
			pair.kind,
			"\n(",
			strconv.Itoa(dLen),
			")\n",
		}
		if dLen > 0 {
			toWrite = append(toWrite,
				strings.Join(*pair.data, "\n"),
				"\n")
		}
		toWrite = append(toWrite, "\n")
		for _, str := range toWrite {
			if _, err := w.WriteString(str); err != nil {
				return err
			}
		}
	}
	w.Flush()
	return nil
}
1171832
func TarballDirectory(dirname, rootdir, tarname string) (string, error) {
	f, err := os.OpenFile(tarname, os.O_CREATE|os.O_TRUNC|os.O_WRONLY, 0666)
	if err != nil {
		return "", err
	}
	h := sha1.New()
	gw := gzip.NewWriter(io.MultiWriter(f, h))
	tw := tar.NewWriter(gw)

	w := TarWalker{
		tw:   tw,
		root: rootdir,
	}
	if err := filepath.Walk(dirname, w.Walk); err != nil {
		return "", err
	}

	if err := tw.Close(); err != nil {
		return "", err
	}
	if err := gw.Close(); err != nil {
		return "", err
	}
	if err := f.Close(); err != nil {
		return "", err
	}

	return fmt.Sprintf("%x", h.Sum(nil)), nil
}
330338
func NewGenerator(filename string) *Generator {
	ret := &Generator{
		imports: map[string]string{
			pkgWriter:       "jwriter",
			pkgLexer:        "jlexer",
			pkgEasyJSON:     "easyjson",
			"encoding/json": "json",
		},
		fieldNamer:    DefaultFieldNamer{},
		marshalers:    make(map[reflect.Type]bool),
		typesSeen:     make(map[reflect.Type]bool),
		functionNames: make(map[string]reflect.Type),
	}

	// Use a file-unique prefix on all auxiliary funcs to avoid
	// name clashes.
	hash := fnv.New32()
	hash.Write([]byte(filename))
	ret.hashString = fmt.Sprintf("%x", hash.Sum32())

	return ret
}
297586
func GenUUID() string {
	uuid := make([]byte, 24)
	n, err := rand.Read(uuid)
	if n != len(uuid) || err != nil {
		log.Fatal("can't generate uuid")
		return ""
	}
	// TODO: verify the two lines implement RFC 4122 correctly
	uuid[8] = 0x80 // variant bits see page 5
	uuid[4] = 0x40 // version 4 Pseudo Random, see page 7

	str := hex.EncodeToString(uuid)
	return fmt.Sprintf("%s-%s-%s-%s-%s", str[:8], str[9:13], str[14:18], str[19:23], str[29:])
}
456541
func ReadGeneral(filename string) (config map[string]interface{}, err error) {
	fileContents, err := ioutil.ReadFile(filename)

	if err == nil {
		json.Unmarshal(fileContents, &config)
	}

	return
}
493205
func (c *Config) LoadAll() (bool, error) {
	c.lock.Lock()
	defer c.lock.Unlock()

	return c.MergeLoaders(c.loaders...)
}
1048377
func (mf *MaterialFilter) GenerateGeneric() (g map[string]interface{}) {
	if mf != nil {
		ignores := []interface{}{}
		for _, ig := range mf.Ignore {
			ignores = append(ignores, ig)
		}
		g = map[string]interface{}{
			"ignore": ignores,
		}
	}
	return
}