tempura.go
func Create(dir, prefix string, data []byte) (path string, err error) {
	var tmp *os.File

	tmp, err = ioutil.TempFile(dir, prefix)
	if err != nil {
		return "", err
	}
	defer tmp.Close()

	_, err = tmp.Write(data)
	if err != nil {
		return "", err
	}

	return tmp.Name(), nil
}
func Create(dir, prefix string, data []byte) (path string, err error) {
	var tmp *os.File

	tmp, err = ioutil.TempFile(dir, prefix)
	if err != nil {
		return "", err
	}
	defer tmp.Close()

	_, err = tmp.Write(data)
	if err != nil {
		return "", err
	}

	return tmp.Name(), nil
}
// Create a new temporary file in the directory dir with a name beginning with prefix,
// writes the provided data into it and returns it's path.
//
// If dir is the empty string, TempFile uses the default directory for temporary files (see os.TempDir).
// Multiple programs calling TempFile simultaneously will not choose the same file.
// It is the caller's responsibility to remove the file when no longer needed.